Devices
Devices are an essential part of Collactr — they are the parent object for the data points that you will be monitoring and the events that they generate. On this page, we’ll dive into the different device endpoints you can use to retrieve your Collactr devices programmatically.
Properties
- Name
deviceName
- Type
- string
- Description
Unique identifier for the device.
- Name
displayName
- Type
- string
- Description
A display name for the device, which can be freely edited.
- Name
definitionIsPublic
- Type
- boolean
- Description
A boolean declaration that marks a device definition as publicly available (true), or only available for your current Collactr environment (false). device definition.
- Name
definitionName
- Type
- string
- Description
Unique identifier for the device definition.
- Name
lastContactUTC
- Type
- timestamp
- Description
Timestamp of when the device lasted posted data to our gateway.
List devices
This endpoint allows you to retrieve a list of all the devices currently available in your Collactr environment.
Request
curl -G https://api.collactr.com/devices/list \
-H "Authorization: Bearer {token}"
Response
{
"status": "success",
"data": [
{
"deviceName": "device_1_hallway",
"displayName": "Hallway",
"definitionIsPublic": false,
"definitionName": "ComfortSensors",
"lastContactUTC": "2023-02-18T09:15:39.821Z"
},
{
"deviceName": "device_2_rd_office",
"displayName": "Open-plan R&D Office",
"definitionIsPublic": false,
"definitionName": "ComfortSensors",
"lastContactUTC": "2023-02-18T09:15:59.139Z"
},
{
"deviceName": "device_3_reception",
"displayName": "Reception",
"definitionIsPublic": false,
"definitionName": "ComfortSensors",
"lastContactUTC": "2023-02-18T09:15:39.854Z"
}
]
}
List devices by definition
This endpoint allows you to list all devices that are connected to a specific device definition. A definition name and public/private declaration are required to list devices by device definition name.
Required attributes
- Name
definitionName
- Type
- string
- Description
The name of the device definition that you want to list devices for.
- Name
definitionIsPublic
- Type
- boolean
- Description
A declaration that tells the API if you want to query by a public or private device definition.
Request
curl -G https://api.collactr.com/devices/listByDefinitionNames \
-H "Authorization: Bearer {token}"
-d '{"definitionName": "ComfortSensors", "definitionIsPublic":false}'
Response
{
"status": "success",
"data": [
{
"deviceName": "device_1_hallway",
"displayName": "Hallway",
"definitionIsPublic": false,
"definitionName": "ComfortSensors",
"lastContactUTC": "2023-02-18T09:15:39.821Z"
},
{
"deviceName": "device_2_rd_office",
"displayName": "Open-plan R&D Office",
"definitionIsPublic": false,
"definitionName": "ComfortSensors",
"lastContactUTC": "2023-02-18T09:15:59.139Z"
},
{
"deviceName": "device_3_reception",
"displayName": "Reception",
"definitionIsPublic": false,
"definitionName": "ComfortSensors",
"lastContactUTC": "2023-02-18T09:15:59.099Z"
}
]
}