IoT Central model export/import issue
I ran into an issue on IoT Central today where I exported a model, deleted it, tried to re-import and it failed. I discovered the issue after some manual manipulation of the exported JSON and it was related to the generated @id property for the request object of a command capability.
This is the displayed error:
This is a fragment of what was exported and where I found the issue:
{
"@id": "dtmi:refrigeratedTrucksDm12012020:RefrigeratedTruck7fe:GoToCustomer;1",
"@type": "Command",
"commandType": "synchronous",
"displayName": {
"en": "Go to customer"
},
"name": "GoToCustomer",
"request": {
"@id": "dtmi:refrigeratedTrucksDm12012020:RefrigeratedTruck7fe:GoToCustomer:__request:CustomerID;1",
"@type": "CommandPayload",
"displayName": {
"en": "Customer ID"
},
"name": "CustomerID",
"schema": "integer"
}
}
This is the edited JSON that worked (I removed the __
characters from the __request
part of the @id):
{
"@id": "dtmi:refrigeratedTrucksDm12012020:RefrigeratedTruck7fe:GoToCustomer;1",
"@type": "Command",
"commandType": "synchronous",
"displayName": {
"en": "Go to customer"
},
"name": "GoToCustomer",
"request": {
"@id": "dtmi:refrigeratedTrucksDm12012020:RefrigeratedTruck7fe:GoToCustomer:request:CustomerID;1",
"@type": "CommandPayload",
"displayName": {
"en": "Customer ID"
},
"name": "CustomerID",
"schema": "integer"
}
}
I hope this helps someone.