Device Types
The 'device types' API allows viewing, creating, modifying, and deleting types associated with the devices in the system. Administrator or super administrator permissions are required.
GET /types
The GET /types endpoint provides a paginated list of device types, which can be filtered by the following fields:
- 'page' (optional): page number to display.
- 'size' (optional): number of elements per page.
- 'sort' (optional): sorting order of the elements; can be ascending (ASC) or descending (DESC) and is based on any of the attributes by which to filter.
- 'id' (optional): identifier of the device type.
- 'name' (optional): name of the device type.
- 'hasDevices' (optional): whether there are devices associated with this type.
- 'toBeProcessed' (optional): boolean indicating if this type of device should be processed.
- 'dashboards.id' (optional): id of an associated dashboard.
- 'dashboards.title' (optional): title of an associated dashboard.
- 'dashboards.url' (optional): url of an associated dashboard.
- 'dashboards.folderId' (optional): id of the folder containing an associated dashboard.
- 'dashboards.folderTitle' (optional): title of the folder containing an associated dashboard.
- 'dashboards.folderUid' (optional): uid of the folder containing an associated dashboard.
- 'dashboards.folderUrl' (optional): url of the folder containing an associated dashboard.
- 'attributes.name' (optional): name of the attribute.
- 'attributes.type' (optional): attribute type; there are three types: 'Text', 'Number', or 'DateTime'.
- 'attributes.unit' (optional): attribute unit.
- 'attributes.staticAttribute' (optional): boolean indicating if the attribute is static.
GET /types/{id}
The GET /types/{id} endpoint provides the device type by its id.
GET /types/template/{id}
The GET /types/template/{id} endpoint provides the template of a device type by its id.
GET /types/{id}/CSV
The GET /types/{id}/CSV endpoint provides the CSV template of a device type by its id. It can be filtered by:
- 'network' (mandatory): network to which the device type belongs; there are three possibilities: 'Lora', 'NBIOT', or 'Wifi'.
POST /types
The POST /types endpoint creates a new device type and must have the following format:
{
"name": "FireSmoke",
"toBeProcessed": false,
"attributes": [
{
"name": "temperature",
"staticAttribute": false,
"type": "Text",
"unit": "celsius"
}
]
}
- 'name' (required): name of the device type.
- 'toBeProcessed' (optional): boolean indicating if this type of device should be processed.
- 'attributes.name' (required when 'attributes' is not null): name of the attribute.
- 'attributes.type' (required when 'attributes' is not null): attribute type; there are three types: 'Text', 'Number', or 'DateTime'.
- 'attributes.unit' (optional): attribute unit.
- 'attributes.staticAttribute' (required when 'attributes' is not null): boolean indicating if the attribute is static.
PUT /types/{id}
The PUT /types/{id} endpoint serves to modify a device type by its id. The data that can be modified are as follows:
- 'toBeProcessed' (optional): boolean indicating if this type of device should be processed.
- 'attributes.name' (required when 'attributes' is not null): name of the attribute.
- 'attributes.type' (required when 'attributes' is not null): attribute type; there are three types: 'Text', 'Number', or 'DateTime'.
- 'attributes.unit' (optional): attribute unit.
- 'attributes.staticAttribute' (required when 'attributes' is not null): boolean indicating if the attribute is static.
PUT /types/{id}/addDashboard
The PUT /types/{id}/addDashboard endpoint serves to add a dashboard to the device type by its id. The data expected are as follows:
- 'id' (optional): id of an associated dashboard.
- 'title' (optional): title of an associated dashboard.
- 'url' (optional): url of an associated dashboard.
- 'folderId' (optional): id of the folder containing an associated dashboard.
- 'folderTitle' (optional): title of the folder containing an associated dashboard.
- 'folderUid' (optional): uid of the folder containing an associated dashboard.
- 'folderUrl' (optional): url of the folder containing an associated dashboard.
PUT /types/{id}/removeDashboard
The PUT /types/{id}/removeDashboard endpoint serves to remove a dashboard from the device type by its id. The data expected are as follows:
- 'id' (optional): id of an associated dashboard.
- 'title' (optional): title of an associated dashboard.
- 'url' (optional): url of an associated dashboard.
DELETE /types/{id}
The DELETE /types/{id} endpoint deletes the device type by its id.