Skip to content

OLAPI is a free open source locations API developed by I.O. Juma, a Kenyan software Software developer. OLAPI allows you to dynamically send requests to get location IDs, Location names, region, elevation/height above sea level, estimated population among other geographical data. To gain access, you just need to submit a sign up form or send a P…

License

Notifications You must be signed in to change notification settings

theambidextrous/ola

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FORMAT: 1A HOST: http://olapi-openlocationsapi.apps.us-east-1.starter.openshift-online.com/

Open Locations API (OLAPI)

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.

Open locations apiv1 Features

  • 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!

Context URL

Open Locations API is hosted by Redhat's Openshift Online here http://olapi-openlocationsapi.apps.us-east-1.starter.openshift-online.com

User Authentication

Sign Up/Create account [POST]

  • 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
      }
    

Access Token [POST]

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"
            }
        }
      

Query for locations

Now that you have access, let us start the play!

Get all locations

  • 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"
                    }
                ]
            }
        }
      

Get location details

  • 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
                    }
                ]
            }
        }
      

Get locations by region

  • 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
                    }
                ]
            }
        }
      

Get locations by Country

  • 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
                    }
                ]
            }
        }
      

Get locations by Category

  • 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
                    }
                ]
            }
        }
      

Get Countries

  • 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

Get Country by id(much more details)

  • 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

Get Country by country code

  • 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

About

OLAPI is a free open source locations API developed by I.O. Juma, a Kenyan software Software developer. OLAPI allows you to dynamically send requests to get location IDs, Location names, region, elevation/height above sea level, estimated population among other geographical data. To gain access, you just need to submit a sign up form or send a P…

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published