Country Information and Conversion API

FREEMIUM
By Klorax | Updated a month ago | Location
Popularity

5.9 / 10

Latency

492ms

Service Level

100%

Health Check

N/A

README

Country Information and Conversion API

The Country Information and Conversion API provides comprehensive country-related data and conversion capabilities, allowing developers to access detailed information about countries worldwide and seamlessly convert between country names and country codes.

Endpoints

Get Country Code by Name

Retrieve the country code based on the country name.

  • URL: /api/country/code/:name
  • Method: GET
  • Parameters:
    • :name - The name of the country.

Example Request:

GET /api/country/code/United States

Example Response:

{
  "code": "US",
  "name": "United States",
  "capital": "Washington, D.C.",
  "population": 331002651,
  "language": "English",
  "currency": "USD",
  "timezone": "UTC-04:00, UTC-05:00"
}

Get Country Name by Code

Retrieve the country name based on the country code.

  • URL: /api/country/name/:code
  • Method: GET
  • Parameters:
    • :code - The country code.

Example Request:

GET /api/country/name/US

Example Response:

{
  "code": "US",
  "name": "United States",
  "capital": "Washington, D.C.",
  "population": 331002651,
  "language": "English",
  "currency": "USD",
  "timezone": "UTC-04:00, UTC-05:00"
}

Additional Country Information

In addition to the country code and name, both endpoints provide the following additional information about each country:

  • capital: The capital city of the country.
  • population: The population count of the country.
  • language: The official language(s) spoken in the country.
  • currency: The currency used in the country.
  • timezone: The time zone(s) observed in the country.

Please note that the additional country information is included in the example responses for both endpoints.

Error Handling

The API returns appropriate HTTP status codes and error responses to indicate various scenarios:

  • 200 OK: Successful request and response.
  • 400 Bad Request: Invalid request parameters or missing required parameters.
  • 404 Not Found: Country not found or invalid country name/code.
  • 500 Internal Server Error: An unexpected error occurred.

Please make sure to handle these status codes appropriately in your application.

Followers: 1
API Creator:
K
Klorax
Morax
Log In to Rate API
Rating: 5 - Votes: 1