2017-04-07 4 views
1

で使用するクエリ文字列現在、「=」記号はオリオンで禁止されています http://fiware-orion.readthedocs.io/en/1.5.0/user/forbidden_characters/index.htmlFIWAREオリオン:サブスクリプションペイロード

しかし、これは、クエリ文字列を使用してサブスクリプションを作成する防ぎ:

$ (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 

結果で:

{ 
    "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 
} 
関連する問題