0

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?

Daniel Widdis
  • 8,424
  • 13
  • 41
  • 63
Ivajlo Iliev
  • 303
  • 1
  • 3
  • 19

1 Answers1

3

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.

TyrManuZ
  • 2,039
  • 1
  • 14
  • 23