Get countries
This article will guide you through how to retrieve countries.
The Postman collection will be used for all examples.
You need a valid countryId
to be able to add a Shipping Address, Billing Address and a Payment Method to a basket.
Prerequisites
accessToken
from Connect flow.
Optional query parameters
filterOnStore
- limits the list of countries to ones with shipping or payment methods available for the given store (based onaccessToken
).maxItems
- limits the number of payment methods returned. The list is paginated.nextPagingToken
- required to fetch the next page. The token is described in detail in Next Paging Token article.
Get countries
Open the Get Countries
request.
Optional query parameters can be added.
Request:
curl -D- -X POST {base_url}/api/v1/countries?filterOnStore=false&maxItems={maxItems}&nextPagingToken={nextPagingToken} \ -H 'Authorization: Bearer <ACCESS_TOKEN>' -H 'Content-Type: application/json' \
Response:
{ "countries": [ { "cultureCode": "{cultureCode}", "id": "{countryId}", "name": "{countryName}" } ], "nextPagingToken": "{nextPagingToken | null}" }
Possible Errors that may occur:
Error | Description | |
---|---|---|
Unauthorized (401) | The token is expired. | |
Forbidden (403) | The token does not have access to this endpoint. |
See Handling failures for more info.