Ficodes / quantumleap-source-operator

Retrieve QuantumLeap history and updates in real time using Context Broker.
Apache License 2.0
0 stars 1 forks source link

Malformed subscriptions #20

Closed JoseSecmotic closed 3 years ago

JoseSecmotic commented 3 years ago

Hi!

When trying to use this operator in wirecloud, I found that the subscriptions returns a 400 Bad request code.

What I have done so far is connect the NGSI browser to this operator, or use the fields that are optional to tell the operator what is the ID. Either way, it results in the following error

Error creating subscription in the context broker server: forbidden characters in /entities/ vector item /id/

Taking a look to the ORION debug logs, I can see that the request is arriving with the following format:

time=2021-10-20T12:51:39.520Z | lvl=INFO | corr=77c14662-31a4-11ec-bf0a-0242ac140011 | trans=1634725723-285-00000000200 | from=35.83.53.189 | srv=howtoservice | subsrv=/howto | comp=Orion | op=logTracing.cpp[141]:logInfoRequestWithPayload | msg=Request received: POST /v2/subscriptions, request payload (524 bytes): {"description":"QuantumLeap source subscription","subject":{"entities":[{"id":"{\"id\":\"temperature-postman3\",\"type\":\"Temperature\",\"TimeInstant\":\"2021-10-19T15:44:48.313Z\",\"location\":\"40.418789, -3.69571\",\"temperature\":212}"}],"condition":{"attrs":["temperature"]}},"notification":{"attrsFormat":"normalized","attrs":["temperature","dateModified","dateObserved"],"http":{"url":"https://ngsiproxy.bigbang.secmotic.com:443/callbacks/7795b420-31a4-11ec-83cd-85f2728d8f05"}},"expires":"2021-10-20T15:51:39.009Z"}, response code: 400

If I go back to POSTMAN, I can see that the previous request is actually malformed, since in the "id" field, the subscription is trying to use the string : {\"id\":\"temperature-postman3\",\"type\":\"Temperature\",\"TimeInstant\":\"2021-10-19T15:44:48.313Z\",\"location\":\"40.418789, -3.69571\",\"temperature\":212}"}

Since it should be just the ID (I tried to use the id, and the subscription is accepted), is it possible that the subscription is malformed? How should I proceed?

Best regards

JoseSecmotic commented 3 years ago

Closing. Using the NGSI browser does not seem to be the best way to do it