Device Control

Add a new device to the system

SecurityOAuth2 or ApiKey
Request
Request Body schema: application/json

Add a new device to the system

DeviceID
string

A 6-byte MAC address associated to the device. This is usually the MAC address associated with the radio or Ethernet interface, depending on the particular device.

AlertState
string

The alert state of a device indicates whether it is currently alarming by flashing it's alarm LED, and exciting its buzzer and vibration motor.

Enum: "off" "active"
Responses
200

Response success

Response Schema: application/json
DeviceID
string

A 6-byte MAC address associated to the device. This is usually the MAC address associated with the radio or Ethernet interface, depending on the particular device.

Position
Array of numbers >= 3 items

A vector representing the last known X, Y, and Z coordinates of the device, respectively. Coordinates are in metres, and may be negative.

Orientation
Array of numbers >= 4 items

A vector representing the W, X, Y, and Z values (respectively) of a normalized quaternion representing the device's orientation.

DeviceFlags
integer

A bitfield integer representing device-specific state information.

AlertState
string

The alert state of a device indicates whether it is currently alarming by flashing it's alarm LED, and exciting its buzzer and vibration motor.

Enum: "off" "active"
FirmwareHash
string

A unique hash identifier that indicates the exact firmware build on an device.

FirmwareVersion
string

The version of the firmware on a device.

DeviceType
string

Indicates whether the device is a gateway device, anchor node, or mobile node. This value is derived from the DeviceFlags bitfield.

Enum: "gateway" "anchor" "mobile"
LastUpdateTime
string <date-time>

The date and time of the last communication from the device.

BatteryLevel
number [ 0 .. 1 ]

The last indicated battery-level as a decimal value between 0..1. This field will be null if the device have not reported its battery level.

LastGatewaySource
string

A URI that specifies the last known network route to a device of the form ZK://{SiteID}::{GatewayID}::{ExternalSource}). ExternalSource may be a UDP end-point for Power-over-Ethernet devices of the form UDP::{Host}:{Port}, or may be a USB connected gateway of the form USB::{DeviceID}.

HardwareType
integer

The hardware type of the device.

Enum: -1 0 1 2 3 4 5 6 7 8 9 10 11
400

Malformed request.

401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

422

Invalid data was sent.

post/devices
Request samples
application/json
{
  • "DeviceID": "00:11:22:33:44:55",
  • "AlertState": "off"
}
Response samples
application/json
{
  • "DeviceID": "00:AA:BB:CC:DD:EE",
  • "Position": [
    ],
  • "Orientation": [
    ],
  • "DeviceFlags": 3,
  • "AlertState": "active",
  • "FirmwareHash": "ec95199c",
  • "FirmwareVersion": "0.10.0",
  • "DeviceType": "anchor",
  • "LastUpdateTime": "2019-08-24T14:15:22Z",
  • "BatteryLevel": 0.85,
  • "LastGatewaySource": "ZK://501::3F2504E0-4F89-11D3-9A0C-0305E82C3301::UDP::10.0.0.220:10000",
  • "HardwareType": -1
}

Update device settings

SecurityOAuth2 or ApiKey
Request
path Parameters
address
required
string

Address of the device (usually it's MAC address)

Request Body schema: application/json

Update device settings.

AlertState
string

The alert state of a device indicates whether it is currently alarming by flashing it's alarm LED, and exciting its buzzer and vibration motor.

Enum: "off" "active"
Responses
200

Response success

Response Schema: application/json
status
integer [ 200 .. 202 ]

The HTTP status code.

success
boolean
400

Malformed request.

401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

404

Resource was not found.

422

Invalid data was sent.

put/devices/{address}
Request samples
application/json
{
  • "AlertState": "active"
}
Response samples
application/json
{
  • "status": 200,
  • "success": true
}

Set the alert state of the device

SecurityOAuth2 or ApiKey
Request
path Parameters
address
required
string

Address of the device (usually it's MAC address)

Request Body schema: application/json

Set the alert state of a device

AlertState
string

The alert state of a device indicates whether it is currently alarming by flashing it's alarm LED, and exciting its buzzer and vibration motor.

Enum: "off" "active"
Responses
200

Response success

Response Schema: application/json
status
integer [ 200 .. 202 ]

The HTTP status code.

success
boolean
400

Malformed request.

401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

404

Resource was not found.

422

Invalid data was sent.

put/devices/{address}/alertState
Request samples
application/json
{
  • "AlertState": "active"
}
Response samples
application/json
{
  • "status": 200,
  • "success": true
}

Soft-delete a device from the system

SecurityOAuth2 or ApiKey
Request
path Parameters
address
required
string

Address of the device (usually it's MAC address)

Responses
200

Response success

Response Schema: application/json
status
integer [ 200 .. 202 ]

The HTTP status code.

success
boolean
401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

404

Resource was not found.

patch/devices/{address}/delete
Request samples
Response samples
application/json
{
  • "status": 200,
  • "success": true
}

Restore a previously soft-deleted device

SecurityOAuth2 or ApiKey
Request
path Parameters
address
required
string

Address of the device (usually it's MAC address)

Responses
200

Response success

Response Schema: application/json
status
integer [ 200 .. 202 ]

The HTTP status code.

success
boolean
401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

404

Resource was not found.

patch/devices/{address}/restore
Request samples
Response samples
application/json
{
  • "status": 200,
  • "success": true
}

Send a raw command to a device

SecurityOAuth2 or ApiKey
Request
path Parameters
address
required
string

Address of the device (usually it's MAC address)

Request Body schema: application/json

Send a raw command to a device

command
string

The raw command string to send to the device.

Responses
200

Response success

Response Schema: application/json
status
integer [ 200 .. 202 ]

The HTTP status code.

success
boolean
400

Malformed request.

401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

404

Resource was not found.

422

Invalid data was sent.

post/devices/{address}/command
Request samples
application/json
{
  • "command": "pairing on"
}
Response samples
application/json
{
  • "status": 200,
  • "success": true
}

Request an on-demand position update from a device

SecurityOAuth2 or ApiKey
Request
path Parameters
address
required
string

Address of the device (usually it's MAC address)

Responses
200

Response success

Response Schema: application/json
status
integer [ 200 .. 202 ]

The HTTP status code.

success
boolean
401

Unauthorized access, invalid credentials were used.

403

Access forbidden. Current token does not have the necessary authority for the operation.

404

Resource was not found.

post/devices/{address}/requestPosition
Request samples
Response samples
application/json
{
  • "status": 200,
  • "success": true
}