2017-04-07 1 views
1

는 현재 '='기호가 오리온에서 금지 가입 페이로드에 사용되는 쿼리 문자열 :FIWARE 오리온 :

$ (curl broker.waziup.io/v1/subscribeContext -s -S --header 'Content-Type: application/json' \ 
--header 'Accept: application/json' --header 'Fiware-Service:waziup' --header 'Fiware-ServicePath:/TEST' -d @- | python -mjson.tool) <<EOF 
{ 
    "entities": [ 
     { 
      "type": "SensingDevice", 
      "isPattern": "false", 
      "id": "Sensor1" 
     } 
    ], 
    "attributes": [ 
     "temperature" 
    ], 
    "reference": "http://localhost/v1/sms/send?contact=0039&msg=Sensor1", 
    "duration": "P1M", 
    "notifyConditions": [ 
     { 
      "type": "ONCHANGE", 
      "condValues": [ 
       "temperature" 
      ] 
     } 
    ], 
    "throttling": "PT1S" 
} 
EOF 

결과 : http://fiware-orion.readthedocs.io/en/1.5.0/user/forbidden_characters/index.html

는하지만이 쿼리 문자열에 가입을 할 수 없습니다 :

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

쿼리 문자열은 매개 변수를 콜백 서버에 전달하는 데 사용됩니다 (다른 방법은 없습니다). 어쨌든 주위에?

답변

1

NGSIv2의 맞춤 알림을 기반으로 알림 URL에 검색어 매개 변수를 설정하는 방법이 있습니다. NGSIv2 specification의 '맞춤 알림'섹션을 확인하십시오.

이 같은 것하고있는 구독 :

POST /v2/subscriptions 
... 

{ 
    "subject": { 
    "entities": [ 
     { 
     "id": "Sensor1", 
     "type": "SensingDevice" 
     } 
    ], 
    "condition": { 
     "attrs": [ "temperature" ] 
    } 
    }, 
    "notification": { 
    "httpCustom": { 
     "url": "http://localhost/v1/sms/send", 
     "qs": { 
     "contact": "0039", 
     "msg": "Sensor1" 
     } 
    }, 
    "attrs": [ "temperature"] 
    }, 
    "expires": "2016-05-07T18:30:00.00Z", 
    "throttling": 1 
} 

참고도 모든 센서는 다음과 같은 방법으로 템플릿을 사용하기위한 등록을 일반화 수 :

POST /v2/subscriptions 
... 

{ 
    "subject": { 
    "entities": [ 
     { 
     "idPattern": "Sensor.*", 
     "type": "SensingDevice" 
     } 
    ], 
    "condition": { 
     "attrs": [ "temperature" ] 
    } 
    }, 
    "notification": { 
    "httpCustom": { 
     "url": "http://localhost/v1/sms/send", 
     "qs": { 
     "contact": "0039", 
     "msg": "${id}" 
     } 
    }, 
    "attrs": [ "temperature"] 
    }, 
    "expires": "2016-05-07T18:30:00.00Z", 
    "throttling": 1 
}