FORMAT: 1A HOST: http://olapi-openlocationsapi.apps.us-east-1.starter.openshift-online.com/
OLAPI is a simple RESTful API developed by Iddriss O. Juma using Nodejs+Mongodb. It enables to query for locations i.e. cities, countries, villages, hotels, rivers, mountains etc via simple REST get/post requests.
- Get list of cities accross the world
- Get location estimated ppulation
- Elevation in feet
- Latitudes
- Longitudes
- Countries
- Country timezones
- Country flags links
- Country calling/dialing codes
- Country languages/translations
- Country capital cities
- Regional trade unions/ blocs
- Country's border states
- many more coming...
OLAPI is opensource, it is released under ISC/BSD license. have fun!
Open Locations API is hosted by Redhat's Openshift Online here http://olapi-openlocationsapi.apps.us-east-1.starter.openshift-online.com
-
Endpoint [/api/v1/users/register-ola-user]
-
Method [post]
-
Request (application/json) +headers
Content-type: application/json
-
Body
{
"name" : "Your full name", "email" : "[email protected]", "phone" : "yourvalidphoneforapikeysms", "password" : "auniquepassword"
}
-
-
Response 200 (application/json)
{ "status": "00", "message": "API User added successfully! Check your phone for Consume key", "data": null }
For you to successfully post any request on OLAPI, you must be authenticated. OLAPI uses standard RESTful authentication approach(Oauth2 implementation) to verify user requests. If your authentication request is successful, you will get a token, which you will use as your skylar-token in request headers.
-
Endpoint [/api/v1/users/authenticate]
-
Method [post]
-
Request (application/json)
+Headers
Content-type: application/json
+Body
{ "consumer_key" : "yourconsumerkeysentviasmsandemail", "secret" : "youruniquepasswordthatyousignedupwith" }
-
Response 201 (application/json)
-
Headers
Content-type: application/json
-
Body
{ "status": "00", "message": "authorized", "data": { "user": true, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkY2JjZDQ0YjdhYTdmMDAxYTEzYmY5YSIsImlhdCI6MTU3MzcxOTgyNywiZXhwIjoxNTczNzIzNDI3fQ.SWEdDmSXbnxCvN4uSTYuHAtGAEXwN9I5riW_L67fS0M" } }
-
Now that you have access, let us start the play!
-
Endpoint [/api/v1/ola]
-
Method [get]
-
Request (application/json)
+Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body
{ "status": "00", "message": "success", "data": { "locations": [ { "locationid": "1100443356", "location": "Abarati", "category": "city" }, { "locationid": "1100443371", "location": "Airport View", "category": "city" } ] } }
-
-
Endpoint [/api/v1/ola/{locationid}]
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body
{ "status": "00", "message": "Success", "data": { "location": [ { "_id": "5dcbe26dba57590019138eeb", "locationid": "1100446977", "location": "Uasin Gishu", "category": "County", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0", "long": "0", "elevfeet": "0", "popest": "0", "country": "Kenya", "__v": 0 } ] } }
-
-
Endpoint [/api/v1/ola/regions/{region}]
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body
{ "status": "00", "message": "Success", "data": { "location": [ { "_id": "5dcbdb7cba5759001913825f", "locationid": "1100443765", "location": "Dunan Farm", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.22", "long": "35.41", "elevfeet": "8389", "popest": "22806", "country": "Kenya", "__v": 0 }, { "_id": "5dcbdb8eba57590019138280", "locationid": "1100443798", "location": "Eldoret", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.52", "long": "35.27", "elevfeet": "6853", "popest": "193282", "country": "Kenya", "__v": 0 }, { "_id": "5dcbdb8fba57590019138281", "locationid": "1100443799", "location": "Eldoretas", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.52", "long": "35.27", "elevfeet": "6853", "popest": "193282", "country": "Kenya", "__v": 0 } ] } }
-
-
Endpoint [/api/v1/ola/countries/{countrycode}]
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body
{ "status": "00", "message": "Success", "data": { "location": [ { "_id": "5dcbdb7cba5759001913825f", "locationid": "1100443765", "location": "Dunan Farm", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.22", "long": "35.41", "elevfeet": "8389", "popest": "22806", "country": "Kenya", "__v": 0 }, { "_id": "5dcbdb8eba57590019138280", "locationid": "1100443798", "location": "Eldoret", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.52", "long": "35.27", "elevfeet": "6853", "popest": "193282", "country": "Kenya", "__v": 0 }, { "_id": "5dcbdb8fba57590019138281", "locationid": "1100443799", "location": "Eldoretas", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.52", "long": "35.27", "elevfeet": "6853", "popest": "193282", "country": "Kenya", "__v": 0 } ] } }
-
-
Endpoint [/api/v1/ola/categories/{category}]
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body
{ "status": "00", "message": "Success", "data": { "location": [ { "_id": "5dcbdb7cba5759001913825f", "locationid": "1100443765", "location": "Dunan Farm", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.22", "long": "35.41", "elevfeet": "8389", "popest": "22806", "country": "Kenya", "__v": 0 }, { "_id": "5dcbdb8eba57590019138280", "locationid": "1100443798", "location": "Eldoret", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.52", "long": "35.27", "elevfeet": "6853", "popest": "193282", "country": "Kenya", "__v": 0 }, { "_id": "5dcbdb8fba57590019138281", "locationid": "1100443799", "location": "Eldoretas", "category": "city", "region": "Uasin Gishu", "countrycode": "KE", "lat": "0.52", "long": "35.27", "elevfeet": "6853", "popest": "193282", "country": "Kenya", "__v": 0 } ] } }
-
-
Endpoint [/api/v1/states/
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body -- a json data
-
-
Endpoint [/api/v1/states/{_id}
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body -- a json data
-
-
Endpoint [/api/v1/states/state{code e.g. KE}
-
Method [get]
-
Request (application/json)
-
Headers
skylar-token: 'yourtokenhere' Content-type: application/json
-
-
Response 200 (application/json)
-
Headers
Content-type: application/json
-
Body -- a json data
-