简体   繁体   English

Fiware Scorpio 将新属性附加到现有实体

[英]Fiware Scorpio appending new attribute to existing entity

I tried to append a new entity to an existing entity.我尝试将新实体 append 转换为现有实体。 Same as in the official example on: https://scorpio.readthedocs.io/en/latest/API_walkthrough.html#updating-an-entity-appending-to-an-entity与官方示例相同: https://scorpio.readthedocs.io/en/latest/API_walkthrough.html#updating-an-entity-appending-to-an-entity

Try to append attribute humidity :尝试 append 属性湿度

curl localhost:9090/ngsi-ld/v1/entities/house2%3Asmartrooms%3Aroom1/attrs -s -S -X PATCH -H 'Content-Type: application/json' -H 'Link: https://pastebin.com/raw/Mgxv2ykn' -d @- <<EOF
{
        "humidity": {
        "value": 34,
        "unitCode": "PER",
        "type": "Property",
        "providedBy": {
                "type": "Relationship",
                "object": "smartbuilding:house2:sensor2222"
        }
  }
}

But I receive the error:但我收到错误:

{
  https://uri.etsi.org/ngsi-ld/default-context/notUpdated : [ {
    https://uri.etsi.org/ngsi-ld/attributeName : {
      "@id" : https://uri.etsi.org/ngsi-ld/default-context/humidity
    },
    https://uri.etsi.org/ngsi-ld/reason : "attribute not found in original entity"
  } ]
}

Can anybody tell me, if they encounter the same problem?谁能告诉我,如果他们遇到同样的问题? Or how to fix this?或者如何解决这个问题?

Thank you in advance!先感谢您!

Hi if you want to append new attribute in existing entity so you should use POST request instead of PATCH.嗨,如果您想在现有实体中使用 append 新属性,那么您应该使用 POST 请求而不是 PATCH。

Sorry for inconvenience, we will update in document as well.很抱歉给您带来不便,我们也会在文档中更新。

Thanks, Amit Raghav.谢谢,阿米特·拉加夫。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM