0

I would like to send data from a device via CURL to an IoT Central for a use case. This works without any problems according to the following scheme:

curl -s -H "authorization: ${AUTH}" --request POST --data "$MESSAGE0" "https://$SCOPE/devices/$DEVICE_ID/messages/events?api-version=2020-03-13"

For the request I used:

$AUTH = SharedAccessSignature sr=xxxxxxx.azure-devices.net%2fdevices%2fmyDeviceName4&sig=yyyyyyyy&se=zzzzzzzzzz
$MESSAGE0 = '{"FillingLevel": 30.0, Geo_Data:{"lon":8.2393, "lat":52.02413,"alt":0}}'
$SCOPE = Scope Id from IoT Central
$DEVICE_ID = myDeviceName

I would now like to use a device model that uses more than one component and I am trying to send telemetry data to the component here as well. similar to what is described here for example: How do I send telemetry data via mqtt to a second component in IoT Central?

My call looks like this:

curl -s -H "authorisation: ${AUTH}" --request POST --data "$MESSAGE0" "https://$SCOPE/devices/$DEVICE_ID/modules/$MODULE_ID/messages/events?api-version=2020-03-13"

with

$MODULE_ID = id of the component
(all other data are the same from first call)

The data is transmitted and no error is given, but unfortunately not assigned to the component. Instead, I get the data displayed as "unmodeleddata".

My question: what should the call look like so that the data can be assigned accordingly?

Many thanks for your help

Init5
  • 23
  • 4

1 Answers1

0

in the case of using the REST for sending a component telemetry data, the name of the component must be sent in the header, see the following example:

dt-subject: thermostat1
Roman Kiss
  • 7,925
  • 1
  • 8
  • 21
  • That's fantastic.It worked now. Thank you very much for the quick support @Roman. May I ask where exactly this is in the documentation? I haven't found anything about it. Thanks again and best regards init5 – Init5 Sep 01 '22 at 12:58
  • you can found all system properties for D2C message in the https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-construct#system-properties-of-d2c-iot-hub-messages btw. please, update your question what must be used for authorization and scope – Roman Kiss Sep 01 '22 at 13:08
  • I updated my question like you requested. Again, thank you so much. – Init5 Sep 01 '22 at 14:59