简体   繁体   English

Fiware IoT Agent Json 拒绝 POST 到 /v2/op/update

[英]Fiware IoT Agent Json refused to POST to /v2/op/update

I am interested in fiware IoT Agent JSON, and i tried to work things out.我对固件物联网代理 JSON 感兴趣,我试图解决问题。 I've mange to install the IoT Agent JSON using this tutorial.我已经使用教程安装了 IoT 代理 JSON。 The tutorial refers about IoT Actuator Connection and to check the connection we have to POST to {IoTAgentIP:Port}/v2/op/update.本教程参考 IoT Actuator Connection 并检查我们必须 POST 到 {IoTAgentIP:Port}/v2/op/update 的连接。 When I post to this endpoint I get:当我发布到这个端点时,我得到:

<html lang="en">

<head>
   <meta charset="utf-8">
   <title>Error</title>
</head>

<body>
   <pre>Cannot POST /v2/op/update</pre>
</body>

</html>

My Post Command Is:我的帖子命令是:

curl -iX POST \
  http://localhost:4041/v2/op/update \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
    "actionType": "update",
    "entities": [
        {
            "type": "Alarm",
            "id": "urn:ngsi-ld:Alarm:001",
            "ring" : {
                "type": "command",
                "value": ""
            }
        }
    ]
}'

And

curl -iX POST \
  http://localhost:4041/v2/op/update \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
    "actionType": "update",
    "entities": [
        {
            "type": "Bell",
            "id": "urn:ngsi-ld:Bell:001",
            "ring" : {
                "type": "command",
                "value": ""
            }
        }
    ]
}'

My IoT agent version is:我的物联网代理版本是:

{
    "libVersion": "2.12.0-next",
    "port": 4041,
    "baseRoot": "/",
    "version": "1.14.0-next"
}

Update - With latest Version of IoTA and orion I get in the IoTA log File the below:更新 - 使用最新版本的 IoTA 和 orion 我在 IoTA 日志文件中得到以下内容:

time=2020-10-22T20:46:49.063Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=Creating initial entity in the Context Broker:
 {
    "url": "http://localhost:1026/v1/updateContext",
    "method": "POST",
    "json": {
        "contextElements": [
            {
                "type": "Bell",
                "isPattern": "false",
                "id": "urn:ngsi-ld:Bell:001",
                "attributes": [
                    {
                        "name": "refStore",
                        "type": "Relationship",
                        "value": "urn:ngsi-ld:Store:001"
                    },
                    {
                        "name": "ring_status",
                        "type": "commandStatus",
                        "value": "UNKNOWN"
                    },
                    {
                        "name": "ring_info",
                        "type": "commandResult",
                        "value": " "
                    },
                    {
                        "name": "TimeInstant",
                        "type": "ISO8601",
                        "value": " "
                    }
                ]
            }
        ],
        "updateAction": "APPEND"
    },
    "headers": {
        "fiware-service": "openiot",
        "fiware-servicepath": "/",
        "fiware-correlator": "7c9fba8d-9262-4f81-9b4e-f71ab57953ff"
    }
} | comp=IoTAgent
time=2020-10-22T20:46:49.063Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=executeWithSecurity | comp=IoTAgent
time=2020-10-22T20:46:49.063Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj {"type":"Bell"} | comp=IoTAgent
time=2020-10-22T20:46:49.069Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Device group for fields [["type"]] not found: [{"type":"Bell"}] | comp=IoTAgent
time=2020-10-22T20:46:49.069Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=error {"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group for fields: [\"type\"] and values: {\"type\":\"Bell\"}","code":404} in get group device | comp=IoTAgent
time=2020-10-22T20:46:49.097Z | lvl=DEBUG | corr=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | trans=7c9fba8d-9262-4f81-9b4e-f71ab57953ff | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=Initial entity created successfully. | comp=IoTAgent

I manage to make it to work with one service group (/iot/d).我设法让它与一个服务组 (/iot/d) 一起工作。 So Post requests to append a sensor goes from /iot/d service group.因此,附加传感器的 Post 请求来自 /iot/d 服务组。 I use docker images (compiled with docker compose, like the example).我使用 docker 图像(使用 docker compose 编译,就像示例一样)。 I also have modified in docker file the IOTA_DEFAULT_RESOURCE just in case to be: IOTA_DEFAULT_RESOURCE= I've used the latest IoT Agent JSON 1.15.0 and the previous Version 2.4.0 of Orion.我还在 docker 文件中修改了 IOTA_DEFAULT_RESOURCE 以防万一: IOTA_DEFAULT_RESOURCE=我使用了最新的 IoT Agent JSON 1.15.0 和之前的 Orion 版本 2.4.0。

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

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