Getting a List of Devices
You can get a list of the devices managed by the IzoT Server with the IzoT REST devices resource. You can get all devices, devices meeting specific search criteria, or devices where a particular field contains a specified value.
For each device, the IzoT Server returns the following properties:
Property | Description |
---|---|
id | Unique identifier for a device |
url | Device address |
name | Device name |
brand | Name of the company that created the interface for the device |
type | Device type |
devid | Unique device identifier set in the IzoT Network Server |
uid | Unique 12-character identifier specified in the Python code when the application was defined |
pid | 16-character program id specified in Python code when the application was defined |
categories | Tags that may be assigned to resources by a client and then used to get all resources for a specified category |
notes | Comment field associated with the datapoint |
active | Status property, indicating the current device status; the value is one of the following values: pending—device discovered but not yet queried for its interface; all devices are set to pending when the IzoT Server is restarted; they remain pending until the first successful poll true—device is actively being polled and is responding to poll requests marginal—device is actively being polled but has failed to respond to several consecutive poll requests false—device has failed many consecutive poll requests and is no longer being actively polled; when the device is discovered again it may transition from false to pending to active |
timestamp | UTC time when the device had last changed state |
datapoints | Collection of datapoints defined in the IzoT Network Server class file for a device matching this pid |
Optional query parameters are as follows:
Parameter | Description |
---|---|
depth = {nested_depth} | Depth to be returned. When displaying the properties of a device, depth 2 includes the value of the datapoints; default is depth 0, do not show the datapoints. |
ref_type = (url | id) | By default, the url field will be a address, but changing the ref_type, the url field would contain a unique primary key. |
search = {search_text} | Searches across several text-related fields for a partial case-insensitive match. Multiple searches may be specified. |
{field_name} = {field_value} | Searches the specified field name for an exact case-sensitive match with {field_value}. Multiple matches may be specified. |
Examples
Get all devices:
http://[hostname]/api/devices/
Get a subset of the devices where the device is enrolled and responding:
http://[hostname]/api/devices/?active=true
Get the properties of a particular device:
http://[hostname]/api/devices/2/