Ivajlo Iliev
Ivajlo Iliev

Reputation: 463

Removing property from operation in Cumulocity does not work?

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?

Upvotes: 0

Views: 67

Answers (1)

TyrManuZ
TyrManuZ

Reputation: 2049

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.

Upvotes: 3

Related Questions