Learn Geo API

Overview

The Learn Geo API is free to use for anyone. It allows users to get details about the countries of the world by region, country, population, or even at random.

Retrieving Information

To retrieve the information about the countries make a get request to the url:

https://learn-geo-api.onrender.com/

a request to the home endpoint will return all countries of the world as an array of objects with the properties name, capital, longitude, latitude, population, code (ISO code), and continent.

Retrieving by Region

To retrieve by region use the following endpoints.

Regionendpoint
North America/na
South America/sa
Europe/eu
Asia/as
Africa/af
Oceania/oc

Retrieving by Name

To retrieve an individual country by name specify the endpoint /name/country where country is the country you need the information from. An example of a retrieving Austria would be /countries/Austria. The name of the country is not case sensitive.

Retrieving by Capital

To retrieve by capital specify the endpoint /capital/capital name where capital name is the capital of the country you need the information from. An example of retrieving Paris would be /capital/Paris. The name of the capital is not case sensitive.

Retrieving by Population

To retrieve by population you can specify the endpoint /population/comparison/amount. comparison can be either greater or lesser. Amount is the population threshold for retrieving all countries with a population greater or lesser than that amount. To retrieve all the countries with less than 1 million population you would specify the endpoint, /population/less/1000000.

Retrieving at Random

To retrieve countries at random use the endpoint /random/amount, where amount is the amount of random countries you want to receive. To receive 5 random countries you would specify the endpoint, /random/5.