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

标签 fiware fiware-orion

过去几天我一直在用 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"
            }
        }
    ]
}

这是故意的还是错误?

我可以克服用其他东西对括号进行编码然后在接收时解码的问题,但是能够直接用实体发送括号会更顺畅,也不会那么烦人。

最佳答案

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

关于fiware - 不能在实体的属性值中使用括号 ( ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33803291/

相关文章:

FIWARE:Orion Context Broker 和 CKAN

mysql - 如果手动运行 Flum,Cygnus 只会将数据保存在 MySql 数据库中

fiware - Rush 无法在我的 Orion Context Broker 上运行

docker - Freeboard 的 Orion 数据源和 Context Broker 之间没有连接

fiware-orion - 无法通过 NGSI Updater Widget 连接到 Orion Context 实例

tomcat7 - Orion 在与 Apache Tomcat 7 一起运行时遇到问题

python - 使用 python 脚本访问 Orion CB

fiware - Orion Context Broker - 按位置查询,没有元素

docker - docker 中的Fiware Orion挂起

fiware - 如何发送Orion中传感器的海量数据