Zones API
Lookup assets using zone intersection.- General
- Importing multiple zones
- Updating multiple Zones
- Remove all zones
- List your zones
- Get a single zone using it’s id
- Delete a single zone using it’s id
- Data Types
General
The general principle is that sometimes searching assets using crowfly distance is not good enough.
For example to search the restaurant that will do the delivery for a specified address, each restaurant has a delivery zone and for topological or business reasons it’s not always the nearest restaurant in charge of your delivery.
The Zones api allows you to associate a delivery zone to each of the restaurants.
You specify the zone=true
argument in the search query, and you will get the stores that have a zone intersecting your point.
$ http https://api.woosmap.com/stores/search?key={YOUR_PUBLIC_KEY}&lat={latitude}&lng={longitude}&zone=true
Importing multiple zones
Importing Zones.
POST /zones
body
application/json
: ZoneList
the zone_id must be unique for a given project.
Request body exemple
{
"zones": [
{
"zone_id": " a_zone_id",
"store_id": "a_store_id",
"polygon": "POLYGON((3.879429393916439 43.60530443381857,3.880003386645626 43.606256108720885,3.880352073817562 43.605211207712344,3.8804379045060386 43.60512963475087,3.880207234530758 43.60505971498156,3.8801857768586387 43.60502087063016,3.879429393916439 43.60530443381857))",
"types": ["delivery"]
}
]
}
Updating multiple Zones
Update multiple Zones. The zones must exists to be updated.
method: PUT
body
application/json
: ZoneList
Remove all zones
Remove Zones
method: DELETE
List your zones
List all zones for the current project, sorted by zone_id
.
GET /zones
Parameters
name | description |
---|---|
limit |
limit |
offset |
offset |
Response application/json
: ZoneList
Get a single zone using it’s id
GET /zones/:zone_id
Response application/json
: Zone
Delete a single zone using it’s id
DELETE /zones/:zone_id
Response application/json
: Message
Data Types
Zone
Type: Object
property | type | description |
---|---|---|
store_id |
String |
required |
zone_id |
String |
required |
polygon |
WKTString |
required |
description |
String ? |
optional |
types |
Array .<String >? |
optional |
Exemple
{
"store_id": "1",
"zone_id": "1",
"polygon": "POLYGON(...)",
"description": "Delivery Zone for store 1",
"types": ["delivery"]
}
ZoneList
Type: Object
property | type | description |
---|---|---|
zones |
Array .<Zone > |
the zones list |
Exemple
{
"zones": [
{
"zone_id": "zone_1",
...
}
]
}
Message
Type: Object
property | type | description |
---|---|---|
message |
String |
the error message |
status |
String |
the status as string |