Skip to main content
Version: 2.0

Partitions

Introduction

Partitions can be used to restrict the management of holders, groups, and rules within a system. These restrictions only apply to users with manager or reporter roles, while users with integrator or admin roles are able to manage entities across all partitions. Partitions might represent individual businesses within a multi-tenant commercial building, departments within a large company, or floors of a multi-story building.

The partition object

{
"id": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"name": "Test Partition",
"users": ["6d4b2edf5b38d7000169b240", "64529c8ba954b300028a64cf", "5da649b8c379b20001b2e4b5"],
"default": true
}
PropertyTypeDescription
idStringThe partition ID.
nameStringThe partition name.
usersString[]An array of user IDs representing the pdk.io users assigned to manage this partition.
defaultBooleanWhether or not this is the default partition.

Basic Endpoints

Create a partition

Request

POST https://systems.pdk.io/{{system_id}}/partitions HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json

{
"name": "Test Partition"
}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
system_tokenHeaderStringYesA valid system token.
nameBodyStringYesThe partition name. This must be unique within a system.
usersBodyString[]NoAn array of user IDs representing the pdk.io users assigned to manage this partition. User IDs can be obtained from the permissions endpoints.

Response

The response contains the ID of the newly created partition object.

HTTP/1.1 200 OK
Content-Type: application/json

{
"id": "619cceb0-ac58-4b15-a8ec-32efcb0476ba"
}

Retrieve a partition

GET https://systems.pdk.io/{{system_id}}/partitions/{{partition_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
partition_idPathStringYesThe partition ID.
system_tokenHeaderStringYesA valid system token.

Response

The response contains a partition object.

HTTP/1.1 200 OK
Content-Type: application/json

{
"id": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"name": "Test Partition",
"users": [
"6d4b2edf5b38d7000169b240",
"64529c8ba954b300028a64cf",
"5da649b8c379b20001b2e4b5"
],
"default": true
}

Update a partition

Request

PUT https://systems.pdk.io/{{system_id}}/partitions/{{partition_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json

{
"name": "Test Partition",
"users": null
}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
partition_idPathStringYesThe partition ID.
system_tokenHeaderStringYesA valid system token.
nameBodyStringYesThe partition name. This must be unique within a system.
usersBodyString[]YesAn array of user IDs representing the pdk.io users assigned to manage this partition. User IDs can be obtained from the permissions endpoints.

Response

HTTP/1.1 204 No Content

Delete a partition

Request

DELETE https://systems.pdk.io/{{system_id}}/partitions/{{partition_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
partition_idPathIntegerYesThe partition ID.
system_tokenHeaderStringYesA valid system token.

Response

HTTP/1.1 204 No Content

List all partitions

GET https://systems.pdk.io/{{system_id}}/partitions HTTP/1.1
Authorization: Bearer {{system_token}}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
includeQueryStringNoA comma-delimited list of additional properties to include in the response. Available properties include attributes, devices, and users.
pageQueryIntegerNoThe zero-based page number used for pagination. The default value is 0.
per_pageQueryIntegerNoThe number of items per page used for pagination. The default value is 10 and the maximum value is 100.
system_tokenHeaderStringYesA valid system token.

Response

The response contains an array of partition objects.

HTTP/1.1 200 OK
Content-Type: application/json

[
{
"id": "619cceb0-ac58-4b15-a8ec-32efcb0476ba",
"name": "Default",
"default": true
},
{
"id": "0c5eeec2-e584-47b7-9c92-3c6879ead7fc",
"name": "Test Partition"
}
]

Update a partition's devices

This endpoint overwrites all the devices assigned to a partition. When adding or removing individual devices, be sure to include the IDs of all other devices.

Request

PUT https://systems.pdk.io/{{system_id}}/partitions/{{partition_id}}/devices HTTP/1.1
Authorization: Bearer {{system_token}}
Content-Type: application/json

{
"devices": [
"11e21062-30fc-40f3-8309-7103c91d6c45",
"99105ab2-0ae2-46ee-a410-3a201c75fa74",
"19f664f2-b30a-4898-b4ce-207b05cd19b6"
]
}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
partition_idPathStringYesThe partition ID.
system_tokenHeaderStringYesA valid system token.
devicesBodyString[]YesAn array of device IDs.

Response

HTTP/1.1 204 No Content

Remove a device from a partition

Request

DELETE https://systems.pdk.io/{{system_id}}/partitions/{{partition_id}}/devices/{{device_id}} HTTP/1.1
Authorization: Bearer {{system_token}}
ParameterLocationTypeRequiredDescription
system_idPathStringYesThe system ID.
partition_idPathStringYesThe partition ID.
device_idPathStringYesThe device ID.
system_tokenHeaderStringYesA valid system token.

Response

HTTP/1.1 204 No Content