How can we help?

Searching:

0 results found

Devices/Post

POST /odata/Devices

Description

To create a new Device.

See the following for request and response details ‒

See Also

Request ‒ Devices/Post

Property Type Description Mandatory
productId String The unique identifier of the Product to which this Device belongs. This ID is returned in response to the Products/Post request. Y
productName String The name of the Product to which this Device belongs. This name was set using the Products/Post request.
serialNumber String The serial number of this Device.
groupId String Specifying this property defines this Device to be a Group Device. Not in use.
active Boolean Specifies whether the Device is active, meaning that it can be used – True/False. Not in use.
firstTimeRegistrationDate Date Time Offset Specifies the date when this Device was first registered. Not in use.
activationDate Date Time Offset Specifies the date when this Device first became active. Not in use.
commandsProtocol String/Enum The protocol used by the Axonize Device SDK to connect to the cloud. The default is AMQP. The options are as follows –

Undefined

  • HTTP
  • AMQP
  • Modbus
  • SNMP
  • Test
isConnected Boolean Indicates the Device’s connectivity status to the Axonize Server. True indicates that the Device responded to the most recent keepAlive ping by the Axonize Server.

Each Device’s Product has a keepAlive field that indicates the frequency at which the Devices of this Product are checked for connectivity.

In addition, each Device can also have an optional keepAliveThreshold, which specifies the frequency at which this specific Device is checked for connectivity. A value in this field overrides the keepAlive field of the Device’s Product.

hubId String Specifies the ID of the hub if there are sensors connected to the hub. This hub ID belongs to the field gateway. Null indicates that it is the hub itself.
hubPrimaryKey and

hubSecondaryKey

String The Device’s primary and secondary keys in the Azure Microsoft Cloud IoT hub.
customId String The Device’s unique identifier in an external system. This enables the correlation of the Axonize Device ID with the external system’s Device ID.
keepAliveThreshold Integer The frequency at which this specific Device is checked for connectivity (in minutes). A value in this field overrides the keepAlive field of the Device’s Product. The isConnected property of this Device indicates the connectivity status of the Device.

The default is 5 minutes, unless otherwise specified.

virtualDeviceStatus String/Enum If this is a Virtual Device, then this property specifies the status of this Device. The options are as follows –

  • Not Available
  • Started
  • Stopped
virtualDeviceEvents String If this is a Virtual Device, then this property is the actual string of its Event Manifest.
redisKey String For Internal use. The key of the Device in the Redis cache.
streamUrl String The video stream URL. The streamUrl has the actual video in it. The video is displayed in the Axonize Portal according to the settings in the Product mediaSettings property.
parentId String The logical parent of this device as opposed to hubId (described above) which is the physical parent.
name String The name of this Device. Y
appId String The Application to which this Device belongs.

This is generated by Axonize and sent in the response to Applications/Post.

userDefinedLocation Object The Device’s GPS coordinates as defined when the Device was created or its definition was modified. This enables the Device/event to be represented on a map.
userDefinedLocation/address String The address of the location. For example –

“address”: “string”,

userDefinedLocation/lat Double The latitude coordinate. For example –

“lat”: 0,

userDefinedLocation/lng Double The longitude coordinate. For example –

“lng”: 0,

userDefinedLocation/updateDate DateTimeOffset The timestamp when the location was last updated. For example –

“updateDate”: “2018-02-21T16:06:34.725Z”

currentLocation Object The Device’s GPS coordinates at the time of the event, which enable the Device/event to be represented on a map. If the Device sent a GPS location reading after a User defined location was set, then the current location is the GPS data from the Device.

This property has the same sub-properties as userDefinedLocation (see above).

coords Object The coordinates specifying the location of this Device in the diagram provided by the customer.
coords/x Integer The x coordinate on the diagram.
coords/y Integer The y coordinate on the diagram.
settings Array of Setting Objects Settings is an array of setting properties. Each setting property represents an Axonize Device object property to be modified on a physical Device in order to affect its functionality.

The Axonize Device SDK must be set up to monitor this Axonize Device object property in order to trigger the proper functionality on the Device.

“settings”: [

{

“name”: “string”,

“desiredValue”: “string”,

“reportedValue”: “string”,

“lastSync”: “2018-08-24T11:14:32.000Z”,

“version”: 0

}

settings/name String A free-text name for the property. This name must be recognized on the physical Device.
settings/desiredValue String The value to be assigned to this property on the physical device.
settings/reportedValue String The value received from the updated physical Device by the Axonize Device SDK as the updatedValue, after it has been updated. This value should be the same as the desiredValue (described above).
settings/version Integer Not in use.
ancestors Array Lists the IDs of the ancestor Devices (parents, parents of parents and so on) of this Device, in no particular order.

“ancestors”: [

{

“id”: “564117c213826b303c123456”,

“name”: “Gateway 5”

},

{

“id”: “564201c084a83518b8123456”,

“name”: “Fridge 23”

}

]

commandsProtocol String/Enum The protocol used by the Axonize Device SDK to connect to the cloud. The default is AMQP. The options are as follows –

Undefined

  • HTTP
  • AMQP
  • Modbus
  • SNMP
  • Test
topic Obsolete

 

Example JSON Devices/Post Request

curl -X POST \

https://api.stg.axonize.com/odata/devices/ \

-H ‘Authorization: Token’ \

-H ‘Content-Type: application/json’ \

-H ‘appId: 801A048A-9F23-429F-BF0D-B6D35B22771E’ \

-d ‘{

{

“name”: “new device”,

“productId”: “5abb8cde21b5bb26b0a31463”

}

Response ‒ Devices/Post

All the same properties in the request are returned in the response. In addition, the response that is returned also contains the following properties –

Property Type Description
deviceId String A unique identifier that is automatically generated for this Device by Axonize.
appId String The Application to which this Device belongs.

This generated by Axonize and sent in the response to Applications/Post.

createDate, createUser, updateDate,updateUser See Common Response Properties.

Example JSON Devices/Post Response

Status 201 – Created

{

“@odata.context”: “http://dev-axonizeapi-axonize.dev-ase-axonize.p.azurewebsites.net/odata/$metadata#Devices/$entity”,

“productId”: “5abb8cde21b5bb26b0a31463”,

“productName”: null,

“serialNumber”: null,

“groupId”: null,

“active”: false,

“firstTimeRegistrationDate”: “0001-01-01T00:00:00Z”,

“activationDate”: “0001-01-01T00:00:00Z”,

“commandsProtocol”: “Undefined”,

“isConnected”: false,

“hubId”: null,

“hubPrimaryKey”: “asdsda”,

“hubSecondaryKey”: “asdfasdf”,

“customId”: null,

“keepAliveThreshold”: 0,

“virtualDeviceStatus”: “NotAvailable”,

“virtualDeviceEvents”: null,

“redisKey”: null,

“streamUrl”: null,

“parentId”: null,

“name”: “new device”,

“id”: “5abb916721b5bb26b0a314bd”,

“appId”: “801A048A-9F23-429F-BF0D-B6D35B22771E”,

“createDate”: “2018-03-28T12:58:15.6976815Z”,

“createUser”: null,

“updateDate”: “0001-01-01T00:00:00Z”,

“updateUser”: null,

“userDefinedLocation”: null,

“currentLocation”: null,

“coords”: null,

“ancestors”: [

{

“id”: “564117c213826b303c123456”,

“name”: “Gateway 5”

},

{

“id”: “564201c084a83518b8123456”,

“name”: “Fridge 23”

}

]

}