Countries
On this page:
THE COUNTRY OBJECT |
|
GET[base]/countries |
|
GET[base]/countries/{countryId} |
|
POST[base]/countries |
|
PUT[base]/countries/{countryId} |
|
DELETE[base]/countries/{countryId} |
The Country object
This object provides the following data about a country:
- countryId string
The identifier of a country.
- countryName string
The name of a country, as per ISO 3166.
- alpha2Code string
Two-letter code of a country, as per ISO 3166.
- alpha3Code string
Three-letter code of a country, as per ISO 3166.
- numericCode string
The numeric code of a country, as per ISO 3166.
- geographicRegionNumericCode string
The numeric code of a country’s geographic region, as per ISO 3166.
- geographicRegionName string
The name of a country’s geographic region, as per ISO 3166.
- createTime string
The date and time when the object has been created.
- updateTime string
The date and time when the object has been last updated.
{
"countryId": "6006dda272f002519c3eb505",
"countryName": "United States",
"alpha2Code": "US",
"alpha3Code": "USA",
"numericCode": "840",
"geographicRegionNumericCode": "021",
"geographicRegionName": "Northern America",
"createTime": "2021-01-01T00:00:00+00:00",
"updateTime": "2021-01-01T00:00:00+00:00"
}
Get a countries list
Use this method to obtain a list of countries.
To obtain detailed information about a specified country, use a separate method to get country details.
Request
Header parameters:
Authorization: Bearer <token>
Query parameters:
This method supports pagination, sorting, and filtering. For details on applying the parameters, refer to the Query parameters section. Possible parameters for filtering and sorting are listed below. For values description, refer to The Country object.
Possible values for the filter
parameter:
countryName
Possible values for the sort_by
parameter:
countryID
countryName
alpha2Code
alpha3Code
numericCode
createTime
defaultupdateTime
GET[base]/countries
curl --location -g --request GET 'https://your.base-url.here/countries?limit=10&offset=0&sort_by=createTime&sort_order=desc&filter[countryName]=United States&filter[alpha2Code]=US&filter[alpha3Code]=USA&filter[numericCode]=840&filter[regionNumericCode]=021' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, the response body contains an array of Country objects providing information about all countries that correspond to the query parameters specified in the request.
Get country details
Use this method to obtain detailed information about a specified country.
To obtain a list of countries, use a separate method to get a list of countries.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- countryId required
The country identifier.
GET[base]/countries/{countryId}
curl --location --request GET 'https://your.base-url.here/countries/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'
Response
In case of success, the response body contains a Country objects providing information about the specified country.
Add a new country
Use this method to add a new country.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Body:
- name string required
The name of the country.
The string value length can’t exceed 1024 characters.
- alpha2Code string required
Two-letter code for the country, as per ISO 3166.
- alpha3Code string required
Three-letter code for the country, as per ISO 3166.
- numericCode string required
The numeric code of the country, as per ISO 3166.
- regionNumericCode string
The numeric code of the country region, as per ISO 3166.
POST[base]v1/countries
curl --location --request POST 'https://your.base-url.here/countries' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "United States",
"alpha2Code": "US",
"alpha3Code": "USA",
"numericCode": "840",
"regionNumericCode": "021"
}'
Response
In case of success, the response body contains a Country objects providing information about the newly created country.
Update a country
Use this method to update the information about a specified country.
Note
Instead of the method described below, you can use a similar method that uses the HTTP verb PATCH.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Path parameters:
- countryId required
The country identifier.
Body:
Values of the following fields can be updated:
- name string required
The name of the country.
The string value length can’t exceed 1024 characters.
- alpha2Code string required
Two-letter code for the country, as per ISO 3166.
- alpha3Code string required
Three-letter code for the country, as per ISO 3166.
- numericCode string required
The numeric code of the country, as per ISO 3166.
- regionNumericCode string
The numeric code of the country region, as per ISO 3166.
PUT[base]/countries/{countryId}
curl --location --request PUT 'https://your.base-url.here/countries/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "United States",
"alpha2Code": "US",
"alpha3Code": "USA",
"numericCode": "840",
"regionNumericCode": "021"
}'
Response
In case of success, the response body contains a Country objects providing information about the updated country.
Delete a country
Use this method to delete a specified country.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- countryId required
The country identifier.
DELETE[base]/countries/{countryId}
curl --location --request DELETE 'https://your.base-url.here/countries/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, no response body is returned.