Bulk operation API best practice

Hello,

I have some requests re how to handle bulk operations via API.

once launched a bulk operation is there any API to control and monitor a bulk operation status?
In particular how would it be possible to look for the list of success and failed operations?
then to retry the failed operation requests?

thanks
KR

Mauro

Hi Mauro,

you can get a bulk operation by id:
https://cumulocity.com/api/10.15.0/#operation/getBulkOperationResource

That result contains a “progress” fragment that tells you about the number of pending / failed / executing / completed operations.

If you want to retry a failed bulk operation, you have to create a new bulk operation with a “failedParentId” instead of “groupId” with the “failedParentId” being the ID of the previous bulk operation. This will automatically retry all failed operations.

https://cumulocity.com/api/10.15.0/#tag/Bulk-operations

thanks Harald,

is there a way also to have the list of failed?
thanks
Mauro

You can get operations by bulk operation ID and status see here: Cumulocity IoT - OpenAPI Specification

thanks @Philipp_Emmel !

in the case of a device is offline at the time of the bulk campaign, when this will return online (anytime after the scheduled campaign), does the platform automatically relaunch the campaign to the device?

Or should we implement a custom logic to monitor the result of the campaign and retry with the failed?

KR

Mauro

Bulk operations are transparent to devices. A Device only sees the individual operation that is created for it. These operations stay in status PENDING until the device picks them up. There is no time limit on this. Whenever the device returns online, it can pick up the operation and execute it.

Of course this will prevent the bulk operation from being completed. The unfinished operation will be shown in its respective status as part of the bulk operation.

1 Like