Duplication Function:
Feature Functionality: This functionality enables the user to duplicate Event(S) from a device and add it to any other device or devices.
Implementation:
- Ensure the device from which data is to be duplicated is linked to a Product which enables this functionality:
“enableDataDuplication”: true - Data duplication:
Patch: Allows setting duplication from a single device.
Example duplicating a Event deom a device to 2 other devices:
PATCH https://api.axonize.com/odata/devices/<deviceId>
Body:
{
"streamDuplicationSettings": [
{
"sourceEventName": "ev",
"sourceEventTypeCode": 7,
"targetDeviceId": "60eee1ed8642d56c8eb713f9
"targetEventName": "ev-dup",
"targetEventTypeCode": 7
},
{
"sourceEventName": "ev",
"sourceEventTypeCode": 7,
"targetDeviceId": "77eee1ed8642d56c8eb713f9
"targetEventName": "ev-dup",
"targetEventTypeCode": 7
}
]
}
Post: Allows setting duplication from several devices.
POST https://api.axonize.com/odata/devices/bulkUpdateStreamDuplicationSettings
Body:
{
"settings": {
"<deviceId1>": [
{
"sourceEventName": "Source Event 1",
"sourceEventTypeCode": 1,
"targetDeviceId": "<targetDeviceId1>",
"targetEventName": "Target Event 1",
"targetEventTypeCode": 1
},
{
"sourceEventName": "Source Event 1",
"sourceEventTypeCode": 1,
"targetDeviceId": "<targetDeviceId2>",
"targetEventName": "Target Event 2",
"targetEventTypeCode": 1
}
],
"<deviceId2>": [
{
"sourceEventName": "Source Event 2",
"sourceEventTypeCode": 1,
"targetDeviceId": "<targetDeviceId2>",
"targetEventName": "Target Event 2",
"targetEventTypeCode": 1
}
]
},
"replaceExistingSettings": true/false
}
*"replaceExistingSettings" : If target device has identical Event (same type and name) it can be overwritten by setting to ‘true’ or untouched by setting to ‘false’
Deleting a device which is the target of Stream Duplication:
Deleting a device which is the target of the stream duplication require to PATCH the source device and edit the settings so the device to be deleted doesn't appear in the Source.
Finding the source device is done by running the below query:
odata/devices?$filter=streamDuplicationSettings/any(d:d/targetDeviceId eq '<target device ID>'