Skip to content

Latest commit

 

History

History
260 lines (206 loc) · 5.39 KB

README.md

File metadata and controls

260 lines (206 loc) · 5.39 KB

REST Countries

Get information about countries via a RESTful API https://restcountries.eu

Build Status

Contribute!

570€ per year aprox. is the cost to maintain and update REST Countries. Please help me cover these costs so I can keep improving this service.

Contribute

2017 costs funded: 3.5%

Stay up-to-date

Follow RESTCountries on Twitter

Or subscribe to the mailing list

API Endpoints

Below are described the REST endpoints available that you can use to search for countries

All

https://restcountries.eu/rest/v2/all

Name

Search by country name. It can be the native name or partial name

https://restcountries.eu/rest/v2/name/{name}
https://restcountries.eu/rest/v2/name/eesti
https://restcountries.eu/rest/v2/name/united

Full Name

Search by country full name

https://restcountries.eu/rest/v2/name/{name}?fullText=true
https://restcountries.eu/rest/v2/name/aruba?fullText=true

Code

Search by ISO 3166-1 2-letter or 3-letter country code

https://restcountries.eu/rest/v2/alpha/{code}
https://restcountries.eu/rest/v2/alpha/co
https://restcountries.eu/rest/v2/alpha/col

List of codes

Search by list of ISO 3166-1 2-letter or 3-letter country codes

https://restcountries.eu/rest/v2/alpha?codes={code};{code};{code}
https://restcountries.eu/rest/v2/alpha?codes=col;no;ee

Currency

Search by ISO 4217 currency code

https://restcountries.eu/rest/v2/currency/{currency}
https://restcountries.eu/rest/v2/currency/cop

Language

Search by ISO 639-1 language code

https://restcountries.eu/rest/v2/lang/{et}
https://restcountries.eu/rest/v2/lang/es

Capital city

Search by capital city

https://restcountries.eu/rest/v2/capital/{capital}
https://restcountries.eu/rest/v2/capital/tallinn

Calling code

Search by calling code

https://restcountries.eu/rest/v2/callingcode/{callingcode}
https://restcountries.eu/rest/v2/callingcode/372

Region

Search by region: Africa, Americas, Asia, Europe, Oceania

https://restcountries.eu/rest/v2/region/{region}
https://restcountries.eu/rest/v2/region/europe

Response Example

https://restcountries.eu/rest/v2/name/afghanistan
[{
	"name": "Afghanistan",
	"topLevelDomain": [".af"],
	"alpha2Code": "AF",
	"alpha3Code": "AFG",
	"callingCodes": ["93"],
	"capital": "Kabul",
	"altSpellings": ["AF", "Afġānistān"],
	"region": "Asia",
	"subregion": "Southern Asia",
	"translations": {
		"de": "Afghanistan",
		"es": "Afganistán",
		"fr": "Afghanistan",
		"ja": "アフガニスタン",
		"it": "Afghanistan"
	},
	"population": 27657145,
	"latlng": [33.0, 65.0],
	"demonym": "Afghan",
	"area": 652230.0,
	"gini": 27.8,
	"timezones": ["UTC+04:30"],
	"borders": ["IRN", "PAK", "TKM", "UZB", "TJK", "CHN"],
	"nativeName": "افغانستان",
	"numericCode": "004",
	"currencies": [{
		"code": "AFN",
		"name": "Afghan afghani",
		"symbol": "؋"
	}],
	"languages": [{
		"iso639_1": "ps",
		"iso639_2": "pus",
		"name": "Pashto",
		"nativeName": "پښتو"
	}, {
		"iso639_1": "uz",
		"iso639_2": "uzb",
		"name": "Uzbek",
		"nativeName": "Oʻzbek"
	}, {
		"iso639_1": "tk",
		"iso639_2": "tuk",
		"name": "Turkmen",
		"nativeName": "Türkmen"
	}]
}]

Filter Response

You can filter the output of your request to include only the specified fields.

https://restcountries.eu/rest/v2/{service}?fields={field};{field};{field}
https://restcountries.eu/rest/v2/all?fields=name;capital;currencies

Sources

Similar projects

License

Mozilla Public License MPL