A Rest Api of country information that you need.
EndPoint Request: http://countryapi.gear.host/v1/Country/getCountries
Suggestion: GearHost is a free hosting web apps, and has a limit of request by hour, I recommended download the repository and made your own server, and use this only for tests. If you like the repository, my work, and you want that this works ever in the current host or other, please Donate, I will thanks you and the developers community too.
Contents
How to Use
- What is CountryAPI
- Why use CountryAPI
- Executing the CountryAPI request
- Request Parameters List
- Request Examples (with parameters)
Buy me a Coffee (Donate)
Footer Docs
How To Use
What is CountryAPI?
Country API is a simple web service, made with REST API architecture, that return a simple Json Object with the verb “GET”, withouth Oauth, Oauth2, or another authetication.
This service return the next data of all the countries in the world:
- isSuccess: If isSuccess is true, that means that all works fine, otherwise we had an error.
- userMessage: This message is for the users, and only it is shown when isSuccess is false.
- technicalMessage: This message is technical, and only it is shown when isSuccess is false, please send us a stack trace.
- totalCount: The total countries found in our database.
- response: Array of countries.
- name
- alpha2Code
- alpha3Code
- nativeName
- region
- subRegion
- latitude
- longitude
- area
- numericCode
- nativeLanguage
- currencyCode
- currencyName
- currencySymbol
- flag
- flagpng
Why use CountryAPI?
- You don’t need to create an account in any web page or application.
- You get a really simple json object.
- You get a basic information of any country.
- You get the flag image of the country.
- You don’t need any type of authentication.
- You don’t have limit of request (Not personally, but yes on server).
- It has the basic and importants features of RestAPI architecture.
- It has many params to request the service (included a pagination and limit).
- It’s completely free and Open source.
- The service is always up (24/7).
- Feel free to use or contribute to improvement it.
Executing the CountryAPI request
Simple example. Only need to open browser and paste the url http://countryapi.gear.host/v1/Country/getCountries.
Or use Postman or similar software with the verb GET, and obtain the json data and/or edit the json in Json Editor Online. For example:
Request Parameters
You can use any parameter that you need.
Parameter list:
Name | Type | Required | SQLConsult Type |
---|---|---|---|
pName |
String | False | LIKE "% %" |
pAlpha2Code |
string | False | Equals |
pAlpha3Code |
string | False | Equals |
pNativeName |
string | False | LIKE "% %" |
pRegion |
string | False | Equals |
pSubRegion |
string | False | Equals |
pAreaFrom |
long? | False | BETWEEN pAreaFrom AND pAreaTo |
pAreaTo |
long? | False | BETWEEN pAreaFrom AND pAreaTo |
pNumericCode |
long? | False | Equals |
pNativeLanguage |
string | False | Equals |
pCurrencyCode |
string | False | Equals |
pCurrencyName |
string | False | LIKE "% %" |
pPage |
int? | False | Pagination |
pLimit |
int? | False | Limit of objects response |
Request Examples
Specific country name
http://countryapi.gear.host/v1/Country/getCountries?pName=Costa%20Rica
{"IsSuccess":true,"UserMessage":null,"TechnicalMessage":null,"TotalCount":1,"Response":[{"Name":"Costa Rica","Alpha2Code":"CR","Alpha3Code":"CRI","NativeName":"Costa Rica","Region":"Americas","SubRegion":"Central America","Latitude":"10","Longitude":"-84","Area":51100,"NumericCode":188,"NativeLanguage":"spa","CurrencyCode":"CRC","CurrencyName":"Costa Rican colón","CurrencySymbol":"₡","Flag":"https://api.backendless.com/2F26DFBF-433C-51CC-FF56-830CEA93BF00/473FB5A9-D20E-8D3E-FF01-E93D9D780A00/files/CountryFlags/cri.svg","FlagPng":"https://api.backendless.com/2F26DFBF-433C-51CC-FF56-830CEA93BF00/473FB5A9-D20E-8D3E-FF01-E93D9D780A00/files/CountryFlagsPng/cri.png"}]}
PD: the request is similar with pNativeName.
Countries with a specific region and subRegion
http://countryapi.gear.host/v1/Country/getCountries?pRegion=Americas&pSubRegion=Central%20America
Region and sub region list
- Africa
- Eastern Africa
- Middle Africa
- Northern Africa
- Southern Africa
- Western Africa
- Americas
- Caribbean
- Central America
- Northern America
- South America
- Asia
- Central Asia
- Eastern Asia
- South-Eastern Asia
- Southern Asia
- Western Asia
- Europe
- Eastern Europe
- Northern Europe
- Southern Europe
- Western Europe
- Oceania
- Australia and New Zealand
- Melanesia
- Micronesia
- Polynesia
- Polar
Country with Alpha code 2 or 3
http://countryapi.gear.host/v1/Country/getCountries?pAlpha2Code=CR
Countries with english like native language
http://countryapi.gear.host/v1/Country/getCountries?pNativeLanguage=eng
Countries with Currency code USD (United States Dollar)
http://countryapi.gear.host/v1/Country/getCountries?pCurrencyCode=USD
Countries with an Area (km2) more than 8000 and less than 12000
http://countryapi.gear.host/v1/Country/getCountries?pAreaFrom=8000&pAreaTo=12000
Countries with limit and pagination
http://countryapi.gear.host/v1/Country/getCountries?pLimit=25&pPage=1 http://countryapi.gear.host/v1/Country/getCountries?pLimit=25&pPage=2
Donate
Servers
PAAS: Host server .Net Web API 2.0
PAAS: Sql server 2008 free
BAAS: Free files storage
Current Version
- v1
21/May/2017
Credits
Author Fabián Rosales - Frosquivel Developer
Contributors List of contributors
References
https://restcountries.eu
https://github.com/aredo/restcountries
License
Copyright 2017 Fabian Rosales
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.