This is places REST API service like geoapify or another similar geographic API with querying and finding places in radius.
- This API works with role-based auth, so if you want to create/update/delete places you must provide one of the master keys in
tokenquerystring
-
POST:/api/v1/auth- returns API token with expiration timeBody
{ "email": "mr_robot@ecorp.com" }Response
{ "token": "<YOUR_TOKEN>", "expiresIn": "24h" }
-
POST:/api/v1/places(admin route) - creates place with provided fields and returns created place with generated_idand timestampsBody
{ // required "category": "goverment", // required "subcategories": ["services", "police"], // required "datasources": ["OSM", "google maps"], "geo": { "coordinates": [34.312321, 62.12476456], // required "lat": 34.312321, //required "long": 62.12476456, // required "country": "Russia", "country_code": "RU", "city": "Moscow", "region": "Khimki", "state": "SZAO", "state_code": "sz", "suburb": "Leninski prospect", "street": "Pushkinskaya", // required "full_address": "Moscow, Khimki, Pushkina 12/23", "address_line1": "string", "address_line2": "string", "address_line3": "string", "postcode": 123457, "third_party": { "google_maps_link": "<GM link>", "osm": "<osm link>", "osm_id": "asdada1231231" } }, "place": { // required "name": "Police department of Khimki", "full_name": "GU MVD of Khimki, Moscow Oblast", "old_name": "Deputy of Khimki", "description": "Police department, located near west road", "is_heritage": false, "is_guarded": true, "authorized_personeel_only": true, "is_goverment_property": true, "founded_by": "Department of Justice of Moscow", "builded_at": "2024-08-11T15:48:00.852Z", "construction_started_at": "2024-08-11T15:48:00.852Z", "builded_by": "REDACTED", "open_hours": { "from": 0, "to": 24 }, "is_always_open": true, "age_from": 21, "facilities": ["parking"], "wikipedia": "<wiki link>", "images": "http://images.com/police-department/1" }, "contacts": { "website": "http://khpd.ru", "websites": ["http://khpd.ru"], "phone_number": "911", "phone_numbers": ["911"], "email": "khpd@p.ru", "emails": ["khpd@p.ru"], "links": ["http://khpd.ru"] }, "law": { "owner": "Department Of Justice", "owner_law_address": "ae12424", "owner_phisycal_address": "Kremlyn", "license": "gov12313", "corp": "S.T.A.R.S." } }Response
{ "_id": "66b744dbde0cb7ff86d627ad", "category": ..., "subcategories": ..., "datasources": ..., "geo": { ... }, "place": { ... }, "contacts": { ... }, "law": { ... }, "createdAt": "2024-08-10T10:45:47.522Z", "updatedAt": "2024-08-10T10:45:47.522Z", "__v": 0 }
-
PATCH:/api/v1/places(admin route) - updates place with provided fields and returns updated placeBody
{ "law": { "owner": "Department Of Justice", "owner_law_address": "[REDACTED]", "owner_phisycal_address": "[REDACTED]", "license": "[REDACTED]", "corp": "S.T.A.R.S." } }Response
{ "_id": "66b744dbde0cb7ff86d627ad", "category": ..., "subcategories": ..., "datasources": ..., "geo": { ... }, "place": { ... }, "contacts": { ... }, "law": { "owner": "Department Of Justice", "owner_law_address": "[REDACTED]", "owner_phisycal_address": "[REDACTED]", "license": "[REDACTED]", "corp": "S.T.A.R.S." }, "createdAt": "2024-08-10T10:45:47.522Z", "updatedAt": "2024-08-10T10:45:47.522Z", "__v": 0 }
-
DELETE:/api/v1/places/:id(admin route) - deletes place by_idResponse
{ "success": true }
GET:/api/v1/places/:id(user route) - returns found place by_id
-
Supports XML format, if you need given data to be in XML use
Content-Typeheader withapplication/xmlResponse
{ "_id": "66b744dbde0cb7ff86d627ad", "category": ..., "subcategories": ..., "datasources": ..., "geo": { ... }, "place": { ... }, "contacts": { ... }, "law": { ... }, "createdAt": "2024-08-10T10:45:47.522Z", "updatedAt": "2024-08-10T10:45:47.522Z", "__v": 0 }
GET:/api/v1/places(user route) - returns places by provided options
-
Supports XML format, if you need given data to be in XML use
Content-Typeheader withapplication/xmlOptions
Querystring Description Example value category Filters place by category shopssubcategories Adds additional categories, that can be divided by "." groceries.vegancity Filters place by city (case is necessary) Moscowcountry Filters place by country (case is necessary) Russiastate Filters place by state (case is necessary) Arizonastate_code Filters place by shortened state AZregion Filters place by state region (case is necessary) Glendalepostcode Filters place by postcode (must be number) 123133builded_by Filters place by creator/builder Stanford Professoropen_from Filters by place opening hours (24h format) 10open_to Filters by place closing hours (24h format) 23is_always_open Filters only always-open places (1 or 0) 1age_from Filters by place minimal allowed age to enter (must be number) 18facilities Filters by place facilities such as parking (string array) parkingdisabled_supportowner Filters by place owner Donald Trumplicense Filters by place license (or any law document) gambling_licensecorp Filters place by owning corp Applesort Sorts places bu build date (1 or -1) -1limit Pagination limit 1offset Pagination offset 2Response
[ { "_id": ..., "category": ..., "subcategories": ..., "datasources": ..., "geo": { ... }, "place": { ... }, "contacts": { ... }, "law": { ... }, "createdAt": ..., "updatedAt": ..., "__v": 0 }, { "_id": ..., "category": ..., "subcategories": ..., "datasources": ..., "geo": { ... }, "place": { ... }, "contacts": { ... }, "law": { ... }, "createdAt": ..., "updatedAt": ..., "__v": 0 } ]
- You can found schema at
/src/api/graphql/schemas/place.graphql - To access Graphql use
/api/v1/graphqlendpoint placesquery supports all options that in http endpoint- To provide api token use
tokenheader, unlike queryparam in http endpoint
- Copy this repo
git clone https://github.com/LCcodder/places-api- Install packages
npm i- Configure environment variables in
.envfile - Make sure you running
Mongodb - Run app
npm startOR
- Copy this repo
git clone https://github.com/LCcodder/places-api- Run Docker compose:
docker compose up --build