Create device or sensor metadata

Sunayana Singh 91 Reputation points Microsoft Employee
2020-05-29T06:54:27.223+00:00

I am following this tutorial https://learn.microsoft.com/en-us/azure/industry/agriculture/ingest-historical-telemetry-data-in-azure-farmbeats to creates a device but it is returning an error. Here is the code I submitted

PS Azure:\> curl -X POST "https://tet-dh1.azurewebsites.net/Device" -H "accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer <My access-token>" -d "{ \"deviceModelId\": \"ID123\", \"hardwareId\": \"MHDN123\", \"reportingInterval\": 900, \"name\": \"Device123\", \"description\": \"Test Device 123\"}"*

Here is the error it returns

{&#34;message&#34;:&#34;Model validation failed&#34;,&#34;status&#34;:400,&#34;code&#34;:&#34;ModelValidationFailed&#34;,&#34;moreInfo&#34;:&#34;[\&#34;Invalid property identifier character: \\\\. Path &#39;&#39;, line 1, position 3.\&#34;]&#34;}curl: (6) Could not resolve host: deviceModelId\: \ID123\,  \hardwareId\: \MHDN123\,  \reportingInterval\: 900,  \name\: \Device123\, \description\   
curl: (6) Could not resolve host: Device   
curl: (6) Could not resolve host: 123}   
curl: (7) Failed to connect to * port 80: Connection refused   
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,967 questions
0 comments No comments
{count} vote

Accepted answer
  1. AshokPeddakotla-MSFT 27,311 Reputation points
    2020-05-29T07:04:04.647+00:00

    You will need to create a device Model first (using DeviceModel API) and then create the device using the id of the deviceModel created.

    \"deviceModelId\": \"ID123\" - Once you create the deviceModel, you can specify the id of that in the input payload of Device.
    Hope this helps.

    0 comments No comments

0 additional answers

Sort by: Most helpful