Zones
A Zone is used to define a ShippingRate for a set of locations.
A maximum number of 100 Zones can be created per Project. Learn more about this limit.
Representations
Zone
idString | Unique ID of the Zone. |
versionInt | Current version of the Zone. |
keyString | User-defined unique identifier for the Zone. |
createdAt | Date and time (UTC) the Zone was initially created. |
createdByBETA | Present on resources created after 1 February 2019 except for events not tracked. |
lastModifiedAt | Date and time (UTC) the Zone was last updated. |
lastModifiedByBETA | Present on resources created after 1 February 2019 except for events not tracked. |
nameString | Name of the Zone. |
descriptionString | Description of the Zone. |
locationsArray of Location | List of locations that belong to the Zone. |
ZoneDraft
keyString | User-defined unique identifier for the Zone. |
nameString | Name of the Zone. |
descriptionString | Description of the Zone. |
locationsArray of Location | List of locations that belong to the Zone. |
ZonePagedQueryResponse
PagedQueryResult with results containing an array of Zone.
limitInt | Number of results requested in the query request. |
offsetInt | Offset supplied by the client or the server default. It is the number of elements skipped, not a page number. |
countInt | Actual number of results returned. |
totalInt | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter |
resultsArray of Zone | Zones matching the query. |
ZoneReference
idString | Unique ID of the referenced Zone. |
typeIdString | "zone" |
objZone | Contains the representation of the expanded Zone. Only present in responses to requests with Reference Expansion for Zones. |
ZoneResourceIdentifier
ResourceIdentifier to a Zone.
Location
A geographical location representing a country and optionally a state within this country. A location can only be assigned to one Zone.
country | Country code of the geographic location. Pattern:^[A-Z]{2}$ |
stateString | State within the country. |
Get Zone
Get Zone by ID
view_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
200Zone
curl -X GET https://api.{region}.commercetools.com/{projectKey}/zones/{id} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
Get Zone by Key
view_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
200Zone
curl -X GET https://api.{region}.commercetools.com/{projectKey}/zones/key={key} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
Query Zones
view_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
/^var[.][a-zA-Z0-9]+$/Any string parameter matching this regular expression | Predicate parameter values. The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results returned. |
offsetInt | Number of results skipped. |
withTotalBoolean | Controls the calculation of the total number of query results. Set to |
curl -X GET https://api.{region}.commercetools.com/{projectKey}/zones -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
Create Zone
manage_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
expand | The parameter can be passed multiple times. |
201Zone
curl -X POST https://api.{region}.commercetools.com/{projectKey}/zones -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"name" : "US","locations" : [ {"country" : "US"} ]}DATA
Update Zone
Update Zone by ID
manage_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
versionInt | Expected version of the Zone on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned. |
actionsArray of ZoneUpdateAction | Update actions to be performed on the Zone. |
200Zone
curl -X POST https://api.{region}.commercetools.com/{projectKey}/zones/{id} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeName","name" : "New Name"} ]}DATA
Update Zone by Key
manage_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
versionInt | Expected version of the Zone on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict will be returned. |
actionsArray of ZoneUpdateAction | Update actions to be performed on the Zone. |
200Zone
curl -X POST https://api.{region}.commercetools.com/{projectKey}/zones/key={key} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"version" : 1,"actions" : [ {"action" : "changeName","name" : "New Name"} ]}DATA
Update actions
Set Key
keyString | If |
actionString | "setKey" |
{"action" : "setKey","key" : "keyString"}
Change Name
actionString | "changeName" |
nameString | New name of the Zone. |
{"action" : "changeName","name" : "changedName"}
Set Description
actionString | "setDescription" |
descriptionString | Description of the Zone. |
{"action" : "setDescription","description" : "new ZoneDescription"}
Add Location
actionString | "addLocation" |
location | Location to be added to the Zone. |
{"action" : "addLocation","location" : {"country" : "AT"}}
Remove Location
actionString | "removeLocation" |
location | Location to be removed from the Zone. |
{"action" : "removeLocation","location" : {"country" : "AT"}}
Delete Zone
Delete Zone by ID
manage_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
versionInt | Last seen version of the resource. |
200Zone
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/zones/{id}?version={version} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'
Delete Zone by Key
manage_orders:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
versionInt | Last seen version of the resource. |
200Zone
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/zones/key={key}?version={version} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}'