Real Estate Agency
1.0.0

This API could have been developped for a real estate agency, that offers rental housing. Accommodations could be either house, or apartment, this is a typical example of polymorphism in API.

This example documentation will be used for blog post article about How to use and document polymorphism in API

This is the documentation for version 1.0.0 of the API. Last update on Mar 3, 2023.

Base URL
http://realestate.agency.io/api/v1

Create an accommodation

POST /accommodation

Example about polymorphism in API. This endpoint 'POST /accommodation' can be used to create either apartment, either house.

application/json

Body object

One of:

Responses

POST /accommodation
curl \
 -X POST http://realestate.agency.io/api/v1/accommodation \
 -H "Content-Type: application/json" \
 -d '{"type":"string","size":139,"monthy_rent":799,"address":"246 Bd Saint-Germain, 75007 Paris","garden_size":3300,"roof_tiles_type":"Clay","solar_panels_power":1200,"basement_size":42}'
Request examples
{
  "type": "string",
  "size": 139,
  "monthy_rent": 799,
  "address": "246 Bd Saint-Germain, 75007 Paris",
  "garden_size": 3300,
  "roof_tiles_type": "Clay",
  "solar_panels_power": 1200,
  "basement_size": 42
}
{
  "type": "string",
  "size": 139,
  "monthy_rent": 799,
  "address": "246 Bd Saint-Germain, 75007 Paris",
  "floor": 2,
  "collective_heating_system": true,
  "elevator": true,
  "parking_spots": 3
}