【问题标题】:Removing property from operation in Cumulocity does not work?从 Cumulocity 的运营中移除财产不起作用?
【发布时间】:2021-08-31 13:57:12
【问题描述】:

我想从 Cumulocity 的操作中删除一个属性。我使用以下代码:

private final DeviceControlApi deviceControl;

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

但是在执行这段代码之后,属性仍然存在。

从操作中删除属性的正确方法是什么?

【问题讨论】:

    标签: properties operation cumulocity


    【解决方案1】:

    Cumulocity IoT 中的 PUT(更新)总是在 JSON 的根级别上进行合并,以便您可以进行部分更新。

    如果你想用你的 PUT 请求删除一个属性,你需要明确地 null

    【讨论】:

    • 是的,我通过 SDK 执行了这个,即将属性设置为 null 并且它被删除了。谢谢!
    猜你喜欢
    • 2016-01-20
    • 1970-01-01
    • 2012-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-25
    相关资源
    最近更新 更多