Removing property from operation in Cumulocity does not work?

65 Views Asked by At

I would like to remove a property from an operation in Cumulocity. I use the following code:

private final DeviceControlApi deviceControl;

OperationRepresentation operation = deviceControl.getOperation(new GId("some_op_id"));
operation.removeProperty("the_property_to_be_removed");
deviceControl.update(operation);

But after executing this piece of code the property is still there.

What is the right way to remove a property from operation?

1

There are 1 best solutions below

1
TyrManuZ On

The PUTs (updates) in Cumulocity IoT always do a merge on root level of the JSON so that you can do a partial update.

If you want to remove a property with your PUT request you need to explicitly to null.