不能在实体的属性值中使用括号()

时间:2015-11-19 11:57:18

标签: fiware fiware-orion

过去几天我一直在试验猎户座,过了一会儿,我按照我想要的方式开始工作。

我面临着意想不到的烦恼,其中给定实体上下文的字符串属性将无法注册。

示例:

http POST [my_orion_server_url]:1026/v1/updateContext < create_push.json

create_push.json是:

{
    "contextElements": [
        {
            "type": "Push",
            "isPattern": "false",
            "id": "Push1",
            "attributes": [
                {
                    "name": "message",
                    "type": "string",
                    "value": "this is a test)"
                }
            ]
        }
    ],
    "updateAction": "APPEND"
}

服务器回复:

HTTP/1.1 200 OK
Content-Length: 129
Content-Type: application/json
Date: Thu, 19 Nov 2015 11:47:03 GMT

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

另一方面,如果我删除括号,一切都按预期工作:

json文件:

{
    "contextElements": [
        {
            "type": "Push",
            "isPattern": "false",
            "id": "Push1",
            "attributes": [
                {
                    "name": "message",
                    "type": "string",
                    "value": "this is a test"
                }
            ]
        }
    ],
    "updateAction": "APPEND"
}

服务器响应:

{
    "contextResponses": [
        {
            "contextElement": {
                "attributes": [
                    {
                        "name": "message", 
                        "type": "string", 
                        "value": ""
                    }
                ], 
                "id": "Push1", 
                "isPattern": "false", 
                "type": "Push"
            }, 
            "statusCode": {
                "code": "200", 
                "reasonPhrase": "OK"
            }
        }
    ]
}

这是故意还是错误?

我可以克服用括号编码括号然后在接收时解码的问题,但是能够直接发送与实体的括号将更顺畅,更不烦人​​。

1 个答案:

答案 0 :(得分:1)

这是预期的行为。请查看Orion documentation