Skip to content
Shivam Mathur edited this page May 14, 2016 · 3 revisions

CountryCity API

CountryCity API is a REST API to get names of all the countries in the world. It can also be used to get names of all the cities in a country.

Installing the API

  • Download the countrycity API using composer by executing the command below.
composer global require codeyeah/countrycity "master-dev"
  • Install the countrycity API using by executing the command below.
composer create-project codeyeah/countrycity countrycity "master-dev" --prefer-dist
  • Download and install MongoDB from here
  • Start MongoDB server by executing the below command.
mongod --dbpath {countrycityapipath}/data/db
  • Install MongoDB pecl extension by following installation instruction from here
  • You are all set.

Get All Countries

/get/countries/

Get All Cities in a Country

/get/cities/{countryName}

Error Format

{"error":"true", "message": "error message here"}
Clone this wiki locally