Search code examples
azure-digital-twins

HardwareId limit does not seem to match documentation limitation


Is there a way to set up a HardwareId longer than 32 characters? Is that limit something that will disappear/be increased later on?

Hardware id needs to match the header in the message according to the documentation https://learn.microsoft.com/en-us/azure/digital-twins/concepts-device-ingress#device-to-cloud-message and there it seems that the length limit is 72.

Tried in the preview version of Azure Digital Twin.

POST to create a space with a HardwareID longer than 32 characters

{
    "name": "Test",
    "typeId": 2,
    "hardwareId": "UUID-C1267664F59144D489F35E8335553D4B",
    "spaceId": "55af6869-097c-4010-9f5f-c882528b41aa"
}

The REST call returns error:

{ "error": { "code": "400.600.000.000", "message": "Invalid value for parameter(s): 'data.HardwareId'" } }


Solution

  • The document you are linking to is talking about Sensor hardware Id. So the Sensor Hardware Id max length is 72 you can confirm that on your Digital Twins Swagger. Swagger it's a tool to assist with development and testing calls made to the Azure Digital Twins Management APIs.

    In the other hand Device hardware Id max length is 36 characters my source for this is also the Digital Twins Swagger.

    Devices are attached to a space. They are entities (physical or virtual) that manage a number of sensors. For example, a device could be a user’s phone, a Raspberry Pi sensor pod, Lora gateway, etc.

    Sensors are attached to a device and a space. They record values. For example: battery level, temperature, noise, motion, etc.

    If you believe that the Device hardware Id max length should be greater than 36 characters please create an entry in the Azure Digital Twins User Voice site. This way other users can upvote your proposal.