Hi @Sukun Jain Greetings! Welcome to Microsoft Q&A forum. Thank you for posting this question here.
I have tested the API Send Telemetry using the Postman and here is how I could send the telemetry.
- I was prompted to include the
Content_Length
attribute in the header section. Please find the below image
- The Content Length attribute has to be set based on your body length. For example, the below body request has content length of 20.
{
"temp": 59
}
For a different twin id with a different property name, I have found the Content-Length 33 to work. Here is my JSON body for this.
{
"Level_of_Material": 71
}
As Sander pointed, you would also need to add Bearer token under the authorization OAuth 2.0
type. Please refer the Call Azure Digital Twins API with Postman for more details on this.
Kindly note that the content length should match the number of bytes in the request body. If it set to a higher value, I have observed that request keeps running and eventually the connection gets closed.
If your request is successful, you would see a 204 response as below
Please also note that the telemetry data cannot be viewed directly on the Azure Digital Twin explorer. Only property values get stored on the Digital Twin state information.
To monitor the telemetry messages, you would have to an event handler to capture Digital Twin Telemetry Message event triggered by the Digital Twin. Kindly refer to the Model Attributes of DTDL for more information on this.
Hope this helps! Please let us know if you have any additional questions or need further clarification.
If the response helped, please do click Accept Answer and Yes for the answer provided. Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.