Zones API

Lookup assets using zone intersection.

  1. General
  2. Importing multiple zones
  3. Updating multiple Zones
  4. Remove all zones
  5. List your zones
  6. Get a single zone using it’s id
  7. Delete a single zone using it’s id
  8. 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 example

{
    "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

Use the limit parameter to define the number of zone to retrieve (max 50). Use the offset parameter to retrieve zones starting from a value.

Response application/json: ZoneList
Default response list is limited to 10 zones. By using the limit parameter you can retrieve up to 50 zones. Using the limit parameter you can retrieve up to 50 zones. If you project contains more than 50 zones, you need to perform multiple request using the limit and offset parameters. Using the limit parameter you can retrieve up to 50 zones.

Example To retrieve up to 40 zones

$ http https://api.woosmap.com/zones?key={YOUR_PUBLIC_KEY}&limit=40

To retrieve zones above the 50th (in this case, up to 20)

$ http https://api.woosmap.com/zones?key={YOUR_PUBLIC_KEY}&limit=50&offset=20

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

Example

{
    "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

Example

{
    "zones": [
        {
            "zone_id": "zone_1",
            ...
        }
    ]
}

Message

Type: Object

property type description
message String the error message
status String the status as string
Was this article helpful?
Have more questions? Submit a request