Devices API

Overview

In a cloud scenario, the device API interacts with IoT Hub and DocumentDB, so that you can define metadata and commands for a device.

Device Object

Property Type Description
Id String Friendly identifier. Identifies the device name in IoT Hub.
PrimaryKey Base64 String Used to securely communicate to IoT Hub. If omitted on creation, the API generates one.
SecondaryKey Base64 String Used when changing the PrimaryKey, but is not needed for general communication. If omitted, the API generates one.
Properties JSON Object Used to store any metadata for the device.
Commands (Deprecated) JSON Array Used to define supported commands for the device.
Telemetries (Deprecated) JSON Array Used to show mapped telemetries for the device.
Status JSON Object Used to show the status for the device.

Example Device Object

{
    "primaryKey": "9S7a6E6WZ8QOTBj03tPIkw==",
    "secondaryKey": "jNJy/EFMsn9PNUEprbBpUA==",
    "properties": {
        "DeviceID": "FakeDevice",
        "HubEnabledState": null,
        "CreatedTime": "2016-12-21T19:00:23.0953022Z",
        "DeviceState": "normal",
        "UpdatedTime": "2016-12-22T21:12:25.4060158Z"
    },
    "commands": [],
    "telemetries": null,
    "shadow": {
        "revision": 27,
        "hash": "UawNMypV+NFQAdmLokDo0/QU7bZUUVDc+iop93yltcg=",
        "schemaVersion": 1,
        "deviceType": 0
    },
    "id": "FakeDevice",
    "subject": null
}
Property Type Description
Id String Friendly identifier. Identifies the device name in IoT Hub.
PrimaryKey Base64 String Used to securely communicate to IoT Hub. If omitted on creation, the API generates one.
SecondaryKey Base64 String Used when changing the PrimaryKey, but is not needed for general communication. If omitted, the API generates one.
Properties JSON Object Used to store any metadata for the device.
Commands (Deprecated) JSON Array Used to define supported commands for the device.
Telemetries (Deprecated) JSON Array Used to show mapped telemetries for the device.
Status JSON Object Used to show the status for the device.