You would need to have a list of the device item_ids that are on a DC that is down... then use those IDs to call and change MDRItemID (DC's itemid the device is polling on).
You could do a filtered GET via REST to get IDs of devices POST http://DA:8581/rest/devices/filtered and body:
<FilterSelect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="filter.xsd">
<Filter><Item.MDRItemID type="EQUAL">down-dc-itemid</Item.MDRItemID></Filter>
<Select use="exclude" isa="exclude"/>
</FilterSelect>
With that result, which is a bunch of IDs, you'd have to parse and cycle the IDs and call for each device ID:
PUT http://DA:8581/rest/devices/<item-id> and body:
<Item version="1.0.0"><MDRItemID>new-dc-item-id</MDRItemID></Item>
Original Message:
Sent: 08-04-2021 10:37 AM
From: Praveen Venkatesan
Subject: Change DC Host for Bulk devices
Hi All,
How to the Data collector IP address for devices in bulk using API. In case one Dc fails we need to move the monitored devices to other ones