Get locations (v1)
https://api.casafari.com/api/v1/references/locationsLegacy API (api.casafari.com). A route of the existing API for Casafari clients with a contract, not of the platform. On the platform: GET /v1/locations/search (search by name).
On the Legacy API at https://api.casafari.com (contract clients): send Authorization: Bearer $CASAFARI_TOKEN; see how to get a token. New users: the platform's REST API, platform API keys.
Description
Returns a list of all possible locations with user restrictions.
Request body
Content type application/json. Optional. Type: object.
namestringcoordinatesobject[]2 properties
latitudenumberrequiredlongitudenumberrequiredzip_codesstring[]langstringExample request
Placeholders only: replace the token and the values with your own.
curl -X POST "https://api.casafari.com/api/v1/references/locations" \
-H "Authorization: Bearer $CASAFARI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "ferreiras",
"coordinates": [
{
"longitude": -8.183479,
"latitude": 37.1404
},
{
"longitude": -8.18482,
"latitude": 37.13909
},
{
"longitude": -8.1854,
"latitude": 37.13805
},
{
"longitude": -8.21646,
"latitude": 37.11383
},
{
"longitude": -8.183479,
"latitude": 37.1404
}
],
"lang": "pt"
}'Responses
200 OK
Type: object.
Show the response shape (11 fields)
locationsobject[]required5 properties
location_idintegerrequirednamestringrequiredparent_idintegerrequiredadministrative_levelstringrequiredlocations_structureobject[]required5 properties
location_idintegerrequiredGET /v1/locations/search).namestringrequiredadministrative_levelstringrequiredzip_codesstring[]levelintegerrequiredExample from the API description (long arrays shortened)
{
"locations": [
{
"location_id": 1603,
"name": "Ferreiras",
"parent_id": 1602,
"administrative_level": "Freguesia",
"locations_structure": [
{
"location_id": 499,
"name": "Portugal",
"administrative_level": "País",
"zip_codes": [
"1200-224"
],
"level": 1
},
{
"location_id": 1597,
"name": "Faro",
"administrative_level": "Distrito",
"zip_codes": [],
"level": 2
}
]
}
]
}401 Unauthorized
Type: object.
Show the response shape (1 fields)
detailstring403 Forbidden
Type: object.
Show the response shape (1 fields)
detailstring