Add a Geozone
POST
/api/v2/geozones.json
Add a Geozone.
Scope
Requires the geozones
OAuth scope.
Request body
Your request body must contain an object including:
data
required
Containing a Geozone object. |
Example
To add a Geozone you must POST JSON to this resource within a data
object. The minimum
requirement for a Geozone is a title
value, however ideally you should also supply
countries
associated with your zone.
{
"data": {
"title": "Europe - Zone 1",
"description": "Countries we ship to the most in Europe",
"countries": [
{
"countryCode": "DE"
},
{
"countryCode": "ES"
},
{
"countryCode": "FR"
}
]
}
}
In the example above we're only importing countryCode
values. regionCodes
are
optional and only applicable to zones used with address data (such as shipping calculations) and should not be used in
zones used for pricing.
In the example below we explore adding regionCodes
for a zone used for local shipping calculations.
Such granular regional settings will typically mean the zone is limited to a single country.
{
"data": {
"title": "East Anglia",
"description": "Local shipping zone",
"countries": [
{
"countryCode": "GB",
"regionaCodes": ["GB-SFK", "GB-NFK", "GB-CAM"]
}
]
}
}
Success responses
If the Geozone was created successfully you should receive a response with a 201
status
code:
success
A boolean where a value of true means the object was created successfully.
|
status
The HTTP status code e.g. 201 means the object was created successfully. |
data
Contains the Geozone object you created including its new id .
|
Error responses
If the Geozone could not be created you will encounter a response with a 422
status code:
success
A boolean where a value of false means the object could not be created.
|
status
A response code of 422 means the object could not be created and you should
check the errors property for further information. |
context
The context property indicates where the error occurred. For a 422 error this
will typically contain a value of data , indicating that there was an error
with the data object supplied. |
errors
Contains an array of error objects, each will have the following properties:
|