4
我一直在嘗試與獵戶座的最後幾天,一段時間後,我做到了工作,我打算的方式。不能在一個實體的屬性值使用括號()
我面臨着一個意想不到的煩惱不過,對於給定的實體上下文字符串屬性將無法註冊。
實施例:
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"
}
}
]
}
這是有意或一個錯誤?
我可以克服這個問題用別的什麼編碼的括號,然後在接收解碼,但能夠直接發送括號與實體會的方式平滑,更討人喜歡。
我想我錯過了,謝謝。 – AArias