FIWARE Orion: use query string in subscription payload -
currently '=' sign forbidden in orion: http://fiware-orion.readthedocs.io/en/1.5.0/user/forbidden_characters/index.html
but prevents make subscription query string:
$ (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
results in:
{ "subscribeerror": { "errorcode": { "code": "400", "details": "illegal value json field", "reasonphrase": "bad request" } } }
the query string used pass parameters callback server (i don't see other ways it). way around this?
there way of setting query parameters in notification url, based in custom notifications in ngsiv2. have "custom notifications" section in ngsiv2 specification.
the subscription doing this:
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 }
note generalize subscriptions sensors using templates, in following way:
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 }
Comments
Post a Comment