CountryCity API by shivammathur

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.

Setup

  1. Download this API using composer by executing the command > composer global require shivammathur/countrycity "master-dev"
  2. Then install this API using by executing the command > composer create-project shivammathur/countrycity countrycity "master-dev" --prefer-dist
  3. You are all set.

Get All Countries

/countries Without URL Rewriting /index.php/countries

Get All Cities in a Country

/cities/{countryName} Without URL Rewriting /index.php/cities/{countryName}

Here are the server configuration instructions if you want to host this on a server.

Error Format

{"error":"true", "message": "error message here"}