The Territory object
Attributes
Unique identifier for the object.
ISO 8601 timestamp of when the object was created.
ISO 8601 timestamp of when the object was last updated.
Default: false
{
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
} /api/setup/territory/{id} Retrieve a territory
Retrieves the details of an existing territory. Supply the unique territory ID that was returned from a previous request.
Path parameters
The identifier of the territory to retrieve.
Returns
Returns the territory object if a valid identifier was provided.
curl https://api.overplane.dev/api/setup/territory/territory_abc123 \
-H "Authorization: Bearer sk_test_..." {
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
} /api/setup/territory List all territorys
Returns a list of territorys. The results are sorted by creation date, with the most recently created appearing first.
Query parameters
Maximum number of objects to return. Default: 20.
Number of objects to skip for pagination. Default: 0.
Returns
A paginated list of territory objects.
curl https://api.overplane.dev/api/setup/territory \
-H "Authorization: Bearer sk_test_..." {
"data": [
{
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
}
],
"has_more": false,
"total": 1
} /api/setup/territory Create a territory
Creates a new territory object.
Body parameters
Default: false
Returns
Returns the newly created territory object if the call succeeded.
curl https://api.overplane.dev/api/setup/territory \
-H "Authorization: Bearer sk_test_..." \
-X POST \
-H "Content-Type: application/json" \
-d '{"territory_name":"territory_name_example"}' {
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
} /api/setup/territory/{id} Update a territory
Updates the specified territory by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Path parameters
The identifier of the territory to update.
Body parameters
Default: false
Returns
Returns the updated territory object.
curl https://api.overplane.dev/api/setup/territory/territory_abc123 \
-H "Authorization: Bearer sk_test_..." \
-X PATCH \
-H "Content-Type: application/json" \
-d '{"parent_id":null,"is_group":false}' {
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
} /api/setup/territory/{id} Delete a territory
Permanently deletes a territory. This cannot be undone.
Path parameters
The identifier of the territory to delete.
Returns
Returns a confirmation that the territory has been deleted.
curl https://api.overplane.dev/api/setup/territory/territory_abc123 \
-H "Authorization: Bearer sk_test_..." \
-X DELETE {
"id": "territory_abc123",
"deleted": true
} /api/setup/territory/{id}/children Get children
Returns the direct children of the specified node in the tree.
Path parameters
The identifier of the territory to act on.
Returns
A list of direct child objects.
curl https://api.overplane.dev/api/setup/territory/territory_abc123/children \
-H "Authorization: Bearer sk_test_..." {
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
} /api/setup/territory/{id}/ancestors Get ancestors
Returns all ancestors from the immediate parent up to the root of the tree.
Path parameters
The identifier of the territory to act on.
Returns
A list of ancestor objects from parent to root.
curl https://api.overplane.dev/api/setup/territory/territory_abc123/ancestors \
-H "Authorization: Bearer sk_test_..." {
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
} /api/setup/territory/{id}/descendants Get descendants
Returns all descendants of the specified node in the tree.
Path parameters
The identifier of the territory to act on.
Returns
A list of all descendant objects.
curl https://api.overplane.dev/api/setup/territory/territory_abc123/descendants \
-H "Authorization: Bearer sk_test_..." {
"id": "territory_abc123",
"created_at": "2024-01-15T09: 30: 00Z",
"updated_at": "2024-01-15T09: 30: 00Z",
"parent_id": null,
"is_group": false,
"territory_name": "territory_name_example",
"parent_territory": "parent_territory_example",
"territory_manager": "territory_manager_example"
}