05-05-2019 9:55 AM - edited 02-04-2024 2:17 AM
Hi,
I want to POST a measure to a Sensor with multiple properties inside its capability. But I can't find the documentation.
I know how to POST a measure to a Sensor with multiple Capabilities:
{
"capabilityAlternateId":["alID1","altID2","altID3"],
"sensorAlternateId":"SensorAltId",
"measures":["value1", "value2", "value3" ]
}
But I my scenario I need the following:
altID1 has multiple properties, how do I pass them in the JSON file?
Best regards,
Wout
Hello Wout,
You can check the possibilities for message payloads towards IoT Services right here:
In the JSON you have posted here, the first issue is that you cannot have an array of "capabilityAlternateId" but you can specify one per JSON Object.
Let's make an example where "alID1" has three properties: "X", "Y" and "Z":
{
"sensorAlternateId": "positionSensor1",
"capabilityAlternateId": "altID1",
"measures": [{
"X": 0.4,
"Y": 1,
"Z": 0
}]
}
This is my preferred format, as you can specify the property name as key. You can also omit that but you'd have to insert the measures into the array in the right order:
{
"sensorAlternateId": "positionSensor1",
"capabilityAlternateId": "altID1",
"measures": [{
0.4,
1,
0
}]
}
If you want to insert different capabilities in the same message, you can include more JSON objects in a JSON array like this, assuming "altID2" has the same properties as "altID1":
[
{
"sensorAlternateId": "positionSensor1",
"capabilityAlternateId": "altID1",
"measures": [{
"X": 0.4,
"Y": 1,
"Z": 0
}]
},
{
"sensorAlternateId": "positionSensor1",
"capabilityAlternateId": "altID2",
"measures": [{
"X": 3,
"Y": 0.5,
"Z": 2.3
}]
}
]
Let me know if this answers your question,
BR,
Federico
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.