Batch Updates
Orion Context Broker allows batch updates to modify multiple entities or attributes in a single API call. This feature is useful when dealing with a large volume of data, as it reduces the overhead of making multiple requests. Batch operations can include creating, updating, or deleting multiple entities or attributes at once, making the system more efficient in real-time IoT scenarios.
Batch Update Entities
A batch update lets you update several entities or attributes in a single API request. This can be particularly useful when managing data from multiple sensors or devices.
Example: Batch Updating Multiple Entities
curl -iX POST \
'http://<orion_host>:1026/v2/op/update' \
-H 'Content-Type: application/json' \
-d '{
"actionType": "append",
"entities": [
{
"id": "Room1",
"type": "Room",
"temperature": {
"value": 25,
"type": "Float"
}
},
{
"id": "Room2",
"type": "Room",
"humidity": {
"value": 70,
"type": "Float"
}
}
]
}'
actionType: The action type can be one of the following:
-
append: Add new attributes or update existing ones.
-
update: Update only existing attributes.
-
delete: Remove specified attributes.
This example sends a batch update for two entities, Room1 and Room2. The temperature attribute of Room1 is updated, and the humidity attribute of Room2 is modified.
Batch Update Response
Upon successful execution, the Orion Context Broker will respond with an HTTP status code:
-
200 OK: The update was successful.
-
207 Multi-Status: Some updates succeeded, while others failed.
Batch updates are a powerful feature when handling large-scale IoT systems where multiple devices need to be updated frequently and in real-time.