Identity API
On the success of the Discovery Call, you will get the URL of the Identity API. This API will provide additional values that will be required to establish the device connection, send telemetry data, etc.
Example:
Request:
Base Url : URL_PROVIDED_BY_DISCOVERY_API
Endpoint : uid/[DEVICE_UNIQUE_ID]
Method : GET
{ "d": { "ec": 0, "ct": 200, "meta": { "at": 1, "df": 60, "cd": "Unique code with 7 or 8 characters", "edge": 0, "pf": "aws|az", "hwv": "Hardware version of the firmware pushed by OTA", "swv": "Software version of the firmware pushed by OTA", "v": 2.1 }, "has": { "d": 1, "attr": 1, "set": 1, "r": 0, "ota": 0 }, "p": { "n": "mqtt", "h": "A string represents the mqtt host name to connect", "p": 8883, "id": "A string represents the mqtt client id", "un": "A string represents the username for mqtt connection", "pwd": "A string represents the password to connect mqtt broker", "topics": { "rpt": "A string represents the publish topic of reporting message", "flt": "A string represents the publish topic of fault message", "od": "A string represents the publish topic of offline message", "hb": "A string represents the publish topic of heartbeat message", "ack": "A string represents the publish topic to send acknowledgements", "dl": "A string represents the publish topic to send Device Logs", "di": "A string represents the publish topic to send Device Identity messages", "c2d": "A string represents the topic for subscribe to receive cloud to device messages", } }, "dt": "YYYY-MM-DDTHH:MM:SS.SSSZ" }, "status": 200, "message": "Device info loaded successfully." } ** "ec": error code, possible Values 0, 1, 2, 3, 4, 5, 6. ** "meta.edge": if 1 then device is Edge Device; else 0 ** "meta.v": Message Protocol Version, possible values 1.0, 2.0, 2.1 ** "has.d": if 1 then device has child device, device must send 204 message to get all child devices; else 0 ** "has.attr": if 1 then device has attributes, device must send 201 message to get all attribute details; else 0 ** "has.set": if 1 then device has setting, device must send 202 message to get updates on settings; else 0 ** "has.r": if 1 then its edge device, device must send 203 message to get all rules; else 0 ** "has.ota": if 1 then device has pending update, device must send 205 message to get pending OTA; else 0
{ "d": { "ec": 0, "ct": 200, "meta": { "at": 1, "df": 60, "cd": "Unique code with 7 or 8 characters", "gtw": { "tg": "String represents the gateway Tag", "g": "GUID represents the device GUID", }, "edge": 0, "pf": "aws|az", "hwv": "Hardware version of the firmware pushed by OTA", "swv": "Software version of the firmware pushed by OTA Device software version", "v": 2.1 }, "has": { "d": 1, "attr": 1, "set": 1, "r": 0, "ota": 0 }, "p": { "n": "mqtt", "h": "A string represents the mqtt host name to connect", "p": 8883, "id": "A string represents the mqtt client id", "un": "A string represents the username for mqtt connection", "pwd": "A string represents the password to connect mqtt broker", "topics": { "rpt": "A string represents the publish topic of reporting message", "flt": "A string represents the publish topic of fault message", "od": "A string represents the publish topic of offline message", "hb": "A string represents the publish topic of heartbeat message", "ack": "A string represents the publish topic to send acknowledgements", "dl": "A string represents the publish topic to send Device Logs", "di": "A string represents the publish topic to send Device Identity messages", "c2d": "A string represents the topic for subscribe to receive cloud to device messages", } }, "dt": "YYYY-MM-DDTHH:MM:SS.SSSZ" }, "status": 200, "message": "Device info loaded successfully." } ** "ec": error code, possible Values 0, 1, 2, 3, 4, 5, 6 ** "meta.edge": if 1 then device is Edge Device; else 0 ** "meta.v": Message Protocol Version, possible values 1.0, 2.0, 2.1 ** "has.d": if 1 then device has child device, device must send 204 message to get all child devices; else 0 ** "has.attr": if 1 then device has attributes, device must send 201 message to get all attribute details; else 0 ** "has.set": if 1 then device has setting, device must send 202 message to get updates on settings; else 0 ** "has.r": if 1 then its edge device, device must send 203 message to get all rules; else 0 ** "has.ota": if 1 then device has pending update, device must send 205 message to get pending OTA; else 0
Click here for more details on values of ec tag
Click here for more details on values of meta.at tag
Bellow are additional topics needs to be subscribed to get setting updates in azure and aws both.
Topic to report property update: $iothub/twin/PATCH/properties/reported/?$rid={version} Subscribe topic to receive desired property value: $iothub/twin/PATCH/properties/desired/# Publish blank message to receive all device Twin: $iothub/twin/GET/?$rid=0 Subscribe topic to receive all device Twin update: $iothub/twin/res/#
Topic to report property update: $aws/things/{clientId}/shadow/name/setting_info/report Subscribe topic to receive desired property value: $aws/things/{clientId}/shadow/name/setting_info/property-shadow