Skip to content

HTTP Interface v1 Zones

Peter Wood edited this page Jan 31, 2021 · 4 revisions

GET: /api/v1/zones

Shows a list of organisation Zones in the controller, that are present at the root level.

The following query parameters alter the result, and can be mixed.

Parameter Effect
include=devices Includes a devices stanza in each zone with all of the devices in that zone, devices may be duplicated in the whole response if a member of multiple zones.
include=subzones Includes all zones recursively, allowing retrieval of the whole tree.

POST: /api/v1/zones

Creates a new zone.

{
    "Name": <name of zone>
}

GET: /api/v1/zones/<zone id>

Shows the specified zone, also permits all options that the root list permits.

DELETE: /api/v1/zones/<zone id>

Deletes the specified zone, zone must have no children or member devices.

PATCH: /api/v1/zones/<zone id>

Modifies the zones metadata.

{
    "Name": <name of zone>,
    "ReorderBefore": <id of zone to place this zone before>,
    "ReorderAfter": <id of zone to place this zone after>
}

All parameters are optional in the body, while ReorderBefore and ReorderAfter can both be specified, ReorderAfter will take priority. A zone can only be reordered within the same parent zone, a zone must be moved to the new parent before it can be reordered.

PUT: /api/v1/zones/<zone id>/devices/<device identifier>

Adds a device to the zone.

DELETE: /api/v1/zones/<zone id>/devices/<device identifier>

Removes a device from the zone.

PUT: /api/v1/zones/<zone id>/subzones/<sub zone id>

Moves a zone to be a sub zone of the first zone, zones can not include circular references and will error if requested.

DELETE: /api/v1/zones/<zone id>/subzones/<sub zone id>

Orphans a zone back to be at the zone root.