简体   繁体   中英

Invalid characters for orion Context Broker

I make some calls to context broker to create elements, but sometimes I get the following error:

{
    "errorCode": {
        "code": "400", 
        "details": "Illegal value for JSON field", 
        "reasonPhrase": "Bad Request"
    }
}

I have done some tests and I have discovered that there are some characters which you get that error.

I found that with "(", ")", "'", ">" , "<",... characters in the value of an attribute return that error.

This is an example of an entity creation that return the error :

(curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{   
    "contextElements": [
        {   
            "type": "Room",
            "isPattern": "false",
            "id": "Room1",
            "attributes": [
            {   
                "name": "temperature",
                "type": "float",
                "value": "23"
            },
            {   
                "name": "pressure",
                "type": "integer",
                "value": "720"
            },
            {   
                "name": "floor",
                "type": "string",
                "value": "3 (B)"
            }
            ]
        }
    ],
    "updateAction": "APPEND"
}
EOF

无效字符(以及对它们进行编码的依据和建议) 在Orion用户手册的本节中进行了说明。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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