0

Recently I saw that in IoT Central app if I create a new Device Template, we get a Interface id in the format like this "dtmi:iosIotCentralApp:DeviceTestTemplate21i;1". And if I use this for DeviceProvisioning function as cmid then I am getting below error in Azure function "Please follow the schema if you want to pass __iot:interfaces section under data. Format: '__iot:interfaces':{'CapabilityModelId': urn:companyname:template:templatename:version, 'CapabilityModel': 'The inline contents of interfaces and capability model.'}"

If I manually create cmid in format (urn:companyname:template:templatename:version) Device is provisioned but not assigned to the specific Device Template.

I am using below API for registration in an Azure function

PUT https://global.azure-devices-provisioning.net/{idScope}/registrations/{registrationId}/register?api-version=2019-03-31

Are there any changes in API for Device provisioning or am I missing anything?

DJ1
  • 11
  • 1
  • 4

1 Answers1

0

This question is related to my answer here.

The following is a DPS payload for passing the model id:

{
  "registrationId":"yourDeviceId",
  "payload": {
     "modelId": "yourDeviceTemplateModelId"
   }
}

See more details in the IoT Plug and Play device developer guide.

Roman Kiss
  • 7,925
  • 1
  • 8
  • 21
  • Thank you. In your code after passing {"modelId": "deviceTemplateModelId"} in json string I was able to assign device to particular Device Template – DJ1 Jun 16 '21 at 16:36
  • Please, don't forget to mark an answer, which it will help others. – Roman Kiss Jun 16 '21 at 16:54