Create a Territory

This API method creates a new territory in a Route4Me user account. Territories can be created in 3 shapes: circular, polygon or rectangular.

POST: https://api.route4me.com/api.v4/territory.php

Parameters

Parameter Type Description HTTP METHOD
api_key string API key of a Route4Me account GET
territory_name string Territory name POST
territory_color string Assign a color to a territory to differentiate it from other ones POST
territory array
territory.type string Choose to define the territory shape:
One of: "circle", "rect", "poly"
POST
territory.data string Data to build a territory POST

Creating a Circle Shape Territory

When creating a circular shape territory, 2 items should be provided in the territory.data array: geographic coordinate pairs and a radius


{
  "territory_name": "Test Avoidance Zone",
  "territory_color": "673ab7",
  "territory": {
    "type": "circle",
    "data": [
      "37.569752822786455,-77.47833251953125",
      "300"
    ]
  }
}

Creating a Rectangle Shape Territory

When creating a rectangular shape territory, 2 geograhic coordinate pairs (end points of the rectangle diagonal) should be provided in the territory.data array.


{
  "territory_name": "Test Avoidance Zone",
  "territory_color": "673ab7",
  "territory": {
    "type": "rect",
    "data": [
      "43.51668853502909,-109.3798828125",
      "46.98025235521883,-101.865234375"
    ]
  }
}

Creating a Polygon Shape Territory

When creating a polygon shape territory, at least 3 geograhic coordinate pairs should be provided in the territory.data array.


{
  "territory_name": "Test Territory",
  "territory_color": "673ab7",
  "territory": {
    "type": "rect",
    "data": [
      "37.569752822786455,-77.47833251953125",
      "37.55886716305343,-77.48974800109863",
      "37.54763966054455,-77.4917221069336"
    ]
  }
}
keyboard_arrow_upResponse Bar