Actions5
Get Country by Code
AI-generatedOverview
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
- Get detailed information about the United States by providing the country code 'US'.
- Fetch country details for Brazil using the country code 'BR'.
- 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
- ISO 3166 Country Codes - Official standard for country codes used in this node.
- country-state-city NPM Package - Library used by the node to fetch country, state, and city data.