Endpoint: countries

The countries dataset provides the core data for countries, returning the full name, abbreviations, capital, population area, and neighboring countries.

https://api.aerisapi.com/countries/

Supported Actions

The following actions are supported with the countries endpoint:

:id Requesting data by using the :id action is used for returning data for a particular item that has an ID associated with it. This is the primary method for requesting general weather information for a single location (observations, forecasts, advisories, etc.) as the location's name or a zip code serves as the id. Other endpoints may expect a certain value for the ID, such as storm cells whose ID value is a combination of the radar site identifier and unique identifier assigned to every storm cell. Refer to an enpoint's detailed documentation for specific information regarding how to use the :id action.
search The search action is used as a more general query method and expects the query to be defined with the custom query for the request. Unlike the closest action, results will not be returned in any particular order.

Supported Parameters

The following parameters are optional unless otherwise noted:

p p=:place Defines the location to query data for. Refer to the list of supported place value formats.
limit limit=:total The total number of results to return as an integer. Each endpoint may have a set maximum for this value depending on usage.

The default limit is 1 if not specified.
query query=:string Used to filter results based on certain fields in the data set. See Advanced Queries for more details.
skip skip=:number Used to skip over a specific number of results in the data set.
fields fields=:string Provides a comma separated list of values for the API to return. This parameter is often used to limit the amount of data returned. See Reducing Output.
callback callback=:functionName Used with JSONP implementation.

Defines the callback function to use for the response. The response will be enclosed as C(response), where C is the callback function provided.

Supported Query Properties

Use the following supported property keys when creating custom queries for your requests:

name Used to query the country full name. String should be lower case.
iso Used to query the country 2 letter ISO abbreviation. Should be lower case.
iso3 Used to query the country 3 letter ISO abbreviation. Should be lower case.
pop Used to query the population.
area Used to query by the area in square kilometers.
altname Used to query alternate names for countries

Sortable Fields

You can use the following fields to sort the data returned in your response:

name Used to sort by the country name

Example:
/countries/search?query=area:500000&sort=name&limit=100 (returns the first 100 countries with at least 500K km of area sorted by the country name)
iso Used to sort by the country 2 letter abbreviation
iso3 Sort by the country 3 letter ISO abbreviation
pop Used to sort by the countries population.
NOTE: Population values are not guaranteed to be accurate and are for general use in limiting results

Example:
/countries/search?query=area:0&sort=pop:-1&limit=100 (returns the top 100 countries based on population descending)

Examples

The /[:endpoint]/[:action]? portion within the query template below can be exchanged with any of the examples. Also, please note you will need to input your client credentials in the [ID] and [SECRET] fields which can be found under the Apps section of the members area.

https://api.aerisapi.com/[:endpoint]/[:action]?client_id=[ID]&client_secret=[SECRET]

Return country information for the US.
/countries/us?

Returns country information for the country specified by zip code 55403 (Minneapolis, MN, US).
/countries/55403?

Returns country information for the closest location to the specified latitude/longitude.
/countries?p=45.25,-95.25&

Returns up to 100 countries that have a population of at least 30 million.
/countries/search?query=pop:30000000&limit=100&

Returns up to 10 countries that have an area of 5 - 10 Million square kilometers.
/countries/search?query=area:5000000:10000000&limit=10&

Response

The following is an example of what each object in the response will consist of. Depending on your requested action, the response may contain multiple instances of this object within an array.


{
    "success": true,
    "error": null,
    "response": {
        "place": {
            "name": "australia",
            "iso": "au",
            "iso3": "aus",
            "isoNum": "036",
            "fips": "as",
            "continent": "oc",
            "continentFull": "australia\/oceana"
        },
        "profile": {
            "capital": "canberra",
            "areaKM": 7686850,
            "areaMI": 4776387.15,
            "pop": 21515754,
            "neighbors": [""]
        }
    }
}
								

Response Properties

The following properties will be provided in every response object:

place.name (string) The name of the country.
place.iso (string) The country's 2-letter ISO abbreviation.
place.iso3 (string) The country's 3-letter ISO abbreviation.
place.isoNum (string) The country's 3-digit ISO numeric ID, kept as a string to preserve leading zeros.
place.fips (string) The country's FIPS abbreviation.
place.continent (string) The continent abbreviation that the country primarily resides.
profile.capital (string) The name of the capital city of the country.
profile.areaKM (number) The approximate area in square kilometers. NOTE: Area values are not guaranteed to be accurate and are for general use in limiting results
profile.areaMI (number) The approximate area in square miles. NOTE: Area values are not guaranteed to be accurate and are for general use in limiting results
profile.pop (number) The approximate population of the country. NOTE: Population values are not guaranteed to be accurate and are for general use in limiting results
profile.neighbors (array) An array of 2-letter ISO abbreviations for the neighboring countries.