Country State City

Get information about countries, states, and cities

Get Country by Code

AI-generated

Overview

This node retrieves detailed geographical information about countries, states, and cities based on ISO codes. Specifically, the 'Get Country by Code' operation fetches detailed information about a country using its ISO 3166-1 alpha-2 code (2 letters). This is useful for workflows that require standardized country data, such as validating user input, enriching datasets with country details, or integrating with systems that use ISO country codes.

Use Case Examples

  1. Get detailed information about the United States by providing the country code 'US'.
  2. Fetch country details for Brazil using the country code 'BR'.
  3. Retrieve country information for Canada with the code 'CA'.

Properties

Name Meaning
Country Code ISO 3166-1 alpha-2 country code (2 letters) used to identify the country for which detailed information is requested.

Output

JSON

  • json - Contains detailed information about the country corresponding to the provided ISO2 country code. The structure includes country details such as name, ISO codes, and other metadata.

Dependencies

  • country-state-city library for geographical data
  • An internal ISO3 to ISO2 country code mapping for validation and conversion

Troubleshooting

  • Ensure the country code provided is a valid ISO 3166-1 alpha-2 code; invalid codes will result in no data returned or errors.
  • If using the ISO3 code operation, ensure the code is valid and correctly mapped to an ISO2 code, otherwise an error 'Invalid ISO3 country code' will be thrown.

Links

Discussion