Create an accommodation
Example about polymorphism in API. This endpoint 'POST /accommodation' can be used to create either apartment, either house.
Body object
POST /accommodation
curl \
-X POST http://realestate.agency.io/api/v1/accommodation \
-H "Content-Type: application/json" \
-d '{"type":"house","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
House (generated)
{
"type": "house",
"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": "flat",
"size": 139,
"monthy_rent": 799,
"address": "246 Bd Saint-Germain, 75007 Paris",
"floor": 2,
"collective_heating_system": true,
"elevator": true,
"parking_spots": 3
}
Request examples
House (generated)
{
"type": "house",
"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": "flat",
"size": 139,
"monthy_rent": 799,
"address": "246 Bd Saint-Germain, 75007 Paris",
"floor": 2,
"collective_heating_system": true,
"elevator": true,
"parking_spots": 3
}