-
-
Notifications
You must be signed in to change notification settings - Fork 51
Home
Shivam Mathur edited this page Sep 15, 2016
·
3 revisions
Country City API is a REST API to get a list of all the countries in the world. It can also be used to get a list of all the cities in a country.
-
Before installing this API you need to install MongoDB pecl extension by following installation instructions from here
-
Download this API using composer by executing the command below.
composer global require shivammathur/countrycity "master-dev"
- Then install the API using by executing the command below.
composer create-project shivammathur/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
- Restore the data into the MongoDB Database by using the below command in a new terminal.
mongorestore {countrycityapipath}/data/db/dump/countrycity/geo.bson
- You are all set.
/get/countries/
/get/cities/{countryName}
{"error":"true", "message": "error message here"}