# Delivery Zones
A delivery zone is an area that is identified by optional coordinates to indicate which branch can serve this zone. Each zone can be assigned to several branches and customer addresses.
# The Delivery Zone Object
# Sample
{
"id": "8cd1956b",
"name": "District 99",
"name_localized": null,
"coordinates": [
[
46.70056343078613,
24.61971032317277
],
[
46.73721313476562,
24.61971032317277
],
[
46.73721313476562,
24.64623705004328
],
[
46.70056343078613,
24.64623705004328
],
[
46.70056343078613,
24.61971032317277
]
],
"created_at": "2019-02-11 07:28:29",
"updated_at": "2019-02-11 07:28:29",
"deleted_at": null,
"reference": "dz01",
"branches": [
{
"id": "8d82ff0"
}
]
}
# Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | Unique identifier for the delivery zone. | |
name* | string | updatable | Name of the delivery zone. |
name_localized | string | nullable updatable | Localized name of the delivery zone. |
reference | string | nullable updatable | Unique reference of the delivery zone. |
coordinates | array | nullable updatable | Coordinates of the delivery zone. |
branches | array | updatable includable | List of Branch objects attached to the delivery zone. |
created_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the delivery zone was created. |
updated_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the delivery zone was updated. |
deleted_at | string | nullable | Time YYYY-MM-DD HH-MM-SS in UTC at which the delivery zone was deleted. |
# List Delivery Zones
GET /delivery_zones
# Scope
general.read
# Filters
idnamename_localizedreferencebranches.idupdated_afteris_deletedcreated_onupdated_ondeleted_on
# Response
{
"data": [
{
"id": "8cd1956b",
"name": "District 99",
"name_localized": null,
"coordinates": [
[
46.70056343078613,
24.61971032317277
],
[
46.73721313476562,
24.61971032317277
],
[
46.73721313476562,
24.64623705004328
],
[
46.70056343078613,
24.64623705004328
],
[
46.70056343078613,
24.61971032317277
]
],
"created_at": "2019-02-11 07:28:29",
"updated_at": "2019-02-11 07:28:29",
"deleted_at": null,
"reference": "dz01",
"branches": [
{
"id": "8d82ff0"
}
]
}
]
}
# Get Delivery Zone
GET /delivery_zones/{deliveryZoneId}
# Scope
general.read
# Response
{
"data": {
"id": "8cd1956b",
"name": "District 99",
"name_localized": null,
"coordinates": [
[
46.70056343078613,
24.61971032317277
],
[
46.73721313476562,
24.61971032317277
],
[
46.73721313476562,
24.64623705004328
],
[
46.70056343078613,
24.64623705004328
],
[
46.70056343078613,
24.61971032317277
]
],
"created_at": "2019-02-11 07:28:29",
"updated_at": "2019-02-11 07:28:29",
"deleted_at": null,
"reference": "dz01",
"branches": [
{
"id": "8d82ff0"
}
]
}
}
# Create Delivery Zone
POST /delivery_zones
# Scope
admin.write
# Request
{
"name": "District 99",
"name_localized": null,
"reference":"dz01",
"coordinates": [
52.2156,
31.0214
],
"branches": [
{
"id": "8cd1956b"
}
]
}
# Response
{
"data": {
"id": "8cd1956b",
"name": "District 99",
"name_localized": null,
"coordinates": [
[
46.70056343078613,
24.61971032317277
],
[
46.73721313476562,
24.61971032317277
],
[
46.73721313476562,
24.64623705004328
],
[
46.70056343078613,
24.64623705004328
],
[
46.70056343078613,
24.61971032317277
]
],
"created_at": "2019-02-11 07:28:29",
"updated_at": "2019-02-11 07:28:29",
"deleted_at": null,
"reference": "dz01",
"branches": [
{
"id": "8d82ff0"
}
]
}
}
# Update Delivery Zone
PUT /delivery_zones/{deliveryZoneId}
# Scope
admin.write
# Request
{
"name": "District 99",
"name_localized": null,
"reference": "dz01",
"coordinates": [
52.2156,
31.0214
],
"branches": [
{
"id": "8cd1956b"
}
]
}
# Response
{
"data": {
"id": "8cd1956b",
"name": "District 99",
"name_localized": null,
"coordinates": [
[
46.70056343078613,
24.61971032317277
],
[
46.73721313476562,
24.61971032317277
],
[
46.73721313476562,
24.64623705004328
],
[
46.70056343078613,
24.64623705004328
],
[
46.70056343078613,
24.61971032317277
]
],
"created_at": "2019-02-11 07:28:29",
"updated_at": "2019-02-11 07:28:29",
"deleted_at": null,
"reference": "dz01",
"branches": [
{
"id": "8d82ff0"
}
]
}
}
# Delete Delivery Zone
DELETE /delivery_zones/{deliveryZoneId}
# Scope
admin.write
The API will respond with 200 indicating that the delivery zone has been deleted.
# Restore Delivery Zone
PUT /delivery_zones/{deliveryZoneId}/restore
# Scope
admin.restore
The API will respond with 200 indicating that the delivery zone has been restored.