Retrieve a list of countries and regions
To see the countries that are currently part of your Commerce instance, issue a GET request to the /ccadmin/v1/countries
endpoint.
The following example shows a sample response body for this request:
[
{
"repositoryId": "AR",
"countryCode": "AR",
"displayName": "Argentina"
},
{
"repositoryId": "AU",
"countryCode": "AU",
"displayName": "Australia"
},
{
"repositoryId": "BD",
"countryCode": "BD",
"displayName": "Bangladesh"
},
{
"repositoryId": "BR",
"countryCode": "BR",
"displayName": "Brazil"
},
{
"repositoryId": "CA",
"countryCode": "CA",
"displayName": "Canada"
},
]
To see a country’s regions that are currently part of your Commerce instance, issue a GET
request to the
/ccadmin/v1/countries/{id}
endpoint. For example, to see all the
Canadian provinces in your Commerce instance, issue a GET
request to the
/ccadmin/v1/countries/{CA}
endpoint. The following example shows a
sample response body for this request. Notice that the response does not return all the
Canadian provinces,, only the ones added to the Commerce instance being queried.
{
"regions": [
{
"regionCode": "CA-AB",
"displayName": "Alberta",
"repositoryId": "CA-AB",
"abbreviation": "AB"
},
{
"regionCode": "CA-BC",
"displayName": "British Columbia",
"repositoryId": "CA-BC",
"abbreviation": "BC"
},
{
"regionCode": "CA-MB",
"displayName": "Manitoba",
"repositoryId": "CA-MB",
"abbreviation": "MB"
},
{
"regionCode": "CA-PE",
"displayName": "Prince Edward Island",
"repositoryId": "CA-PE",
"abbreviation": "PE"
},
{
"regionCode": "CA-QC",
"displayName": "Quebec",
"repositoryId": "CA-QC",
"abbreviation": "QC"
},
{
"regionCode": "CA-SK",
"displayName": "Saskatchewan",
"repositoryId": "CA-SK",
"abbreviation": "SK"
},
],
"countryCode": "CA",
"displayName": "Canada",
"repositoryId": "CA",
"links": [
{
"rel": "self",
"href": "http://servername:9080/ccadmin/v1/countries/CA"
}
]
}