fiware-orion notification failure with https - fiware-orion

I have a problem with my Fiware-Orion (2.1.0) notifications with Quantum-Leap for managing time-series datas (related to that component quantumleap ).
Both are within Docker containers and using HTTPS.
In orion I create the subscription for Quantum-Leap. It works.
And when I create or update an entity, Orion send me an 200 OK response and the notification never reach Quantum-Leap.
I have nothing in logs.
When I make a request directly to an endpoint using Curl or Postman, the request works. Requests using Orion always fail.
Here is the curl used by Postman to QuantmLeap that works.
curl -X POST \
https://ql1-dev.mydomain.com/v2/notify \
-H 'Accept: application/json' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Fiware-Service: svctestnca' \
-H 'Fiware-ServicePath: /svcpath/testnca' \
-H 'Host: ql1-dev.intranice.ville-nice.fr' \
-H 'Ngsiv2-AttrsFormat: normalized' \
-H 'Postman-Token: 76255023-47e3-44c5-8abf-d184a1dd77f0,adaa68e0-abf4-4fea-855d-39c3469ba1d4' \
-H 'User-Agent: PostmanRuntime/7.11.0' \
-H 'accept-encoding: gzip, deflate' \
-H 'cache-control: no-cache' \
-H 'content-length: 279' \
-d '{
"subscriptionId": "5c62b47f132e5369012c4726",
"data": [
{
"id": "Testnca:testnca1",
"type": "Testnca",
"dateObserved": {
"type": "DateTime",
"value": "2019-02-04T16:19:22.00Z"
},
"mesure": {
"type": "Number",
"value": 2.0
}
}
]
}'
Thanks for help and advices

I tried to use HAProxy like in this Stack-Overfow question and it solves my problem.
Orion always add the port number to my request and I missed that element.
Thank you all and especially StephaneRouxNCA

Related

Remove 'accept: */*' (header) from curl commands generated by Swagger Editor?

I'm using the online Swagger Editor. When I send a request using "try it out", it generates this curl command:
curl -X 'POST' \
'https://coo.amazonaws.com/' \
-H 'accept: */*' \ # Extra one
-H 'X-Amz-Target: send by me ' \
-H 'Authorization: Bearer "token"' \
-H 'Content-Type: application.1' \
-d '{
"AuthParameters": {
"USERNAME": "John",
"PASSWORD": "James"
},
Remove-H 'accept: */*' from header in the curl command.

How to make a manual commit by using REST proxy

What I'm trying to do is make a manual commit using the Kafka REST proxy. I'm trying to use this code:
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" -H "Accept: application/vnd.kafka.v2+json" \
--data '{"format": "json", "auto.commit.enable": "false", "auto.offset.reset": "earliest"}' \
http://localhost:8082/consumers/test_consumer
// Subscribe
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" --data '{"topics":["test.sap.pn.add"]}' \
http://localhost:8082/consumers/test_consumer/instances/rest-consumer-587fceb2-2f2c-404f-b71d-c3eb3c678bac/subscription
// Get data
curl -X GET -H "Accept: application/vnd.kafka.json.v2+json" \
http://localhost:8082/consumers/test_consumer/instances/rest-consumer-587fceb2-2f2c-404f-b71d-c3eb3c678bac/records
// commit
curl -X POST -H "Accept: application/vnd.kafka.v1+json, application/vnd.kafka+json, application/json" \
http://localhost:8082/consumers/test_consumer/instances/rest-consumer-587fceb2-2f2c-404f-b71d-c3eb3c678bac/offsets
Which then returns: {"error_code":40403,"message":"Consumer instance not found."}
What am I doing wrong?

How to include fiware-service and fiware-servicePath headers in an Orion Context Broker registration to a Context Provider?

We are researching about the Orion Context Broker technology using local Docker containers and trying to integrate the local Context Broker with an external Context Provider.
Specifically, we are trying to retrieve data from this Context provider:
https://streams.lab.fiware.org/v2/entities?type=AirQualityObserved&options=keyValues
Using the headers:
fiware-service: environment
fiware-servicePath: /Madrid
Concretely, our objective is to achieve a registration from our Context Broker to this node of the provider, in order to get some attributes that we don't have in local (in that example, the attribute is called "NO").
The request we are sending for the registration is the following one:
curl -iX POST \
'http://localhost:1026/v2/registrations' \
-H 'Content-Type: application/json' \
-d '{
"description": "Air Quality Madrid",
"dataProvided": {
"entities": [
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}
],
"attrs": [
"NO"
]
},
"provider": {
"http": {
"url": "https://streams.lab.fiware.org"
}
}
}'
Additionally, we have created a local entity with the same id as in the request: Madrid-AirQualityObserved-28079059-latest
After that information, the question is:
Is it possible to include the specific fiware-service and fiware-servicePath headers into the registration request? What is the way to include them?
Thanks in advance.
EDIT:
I've been doing more tests with the following commands:
For registering to the context provider, using the specific headers for the desired service. For now, the local entity is not created in the local context broker.
curl -iX POST \
'http://localhost:1026/v2/registrations' \
-H 'Content-Type: application/json' \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid' \
-d '{
"description": "Air Quality Madrid",
"dataProvided": {
"entities": [
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}
],
"attrs": [
"NO"
]
},
"provider": {
"http": {
"url": "https://streams.lab.fiware.org"
}
}
}'
Then, I've check if the registration has been correctly registered:
curl -X GET http://localhost:1026/v2/registrations \
-H 'fiware-service: environment'
-H 'fiware-servicepath: /Madrid'
Finally, I've tried to retrieve the entity from the provider:
curl -X GET http://localhost:1026/v2/entities/Madrid-AirQualityObserved-28079059-latest \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid'
But the response indicates that there is not any entity for that request. Because of that, I've created the entity in the local context broker, excluding the field that I'm trying to obtain from the provider "NO".
curl -iX POST \
'http://localhost:1026/v2/entities' \
-H 'Content-Type: application/json' \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid' \
-d '
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}'
However, if I consult the entity with the ID Madrid-AirQualityObserved-28079059-latest, I'm receiving the local data, and the field "NO" is not being retrieved from the provider. That is the response (missing the NO field):
{
"id": "Madrid-AirQualityObserved-28079059-latest",
"type": "AirQualityObserved"
}
What I am doing wrong?
Yes, it's possible.
They are included as regular headers. For instance, if you are using curl, it would be something like -H 'fiware-service: environment' -H 'fiware-servicepath: /Madrid'.
EDIT:
Looking to the query request you are using:
curl -X GET http://localhost:1026/v2/entities/Madrid-AirQualityObserved-28079059-latest \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid'
I see are not incluing the entity type in the query, contrary to the recomendation in the context providers and request forwarding documentantation:
On forwarding, any type of entity in the NGSIv2 update/query matches registrations without entity type. However, the opposite doesn't work, so if you have registrations with types, then you must use ?type in NGSIv2 update/query in order to obtain a match. Otherwise you may encounter problems, like the one described in this post at StackOverflow.
So maybe you should use:
curl -X GET http://localhost:1026/v2/entities/Madrid-AirQualityObserved-28079059-latest?type=AirQualityObserved \
-H 'fiware-service: environment' \
-H 'fiware-servicepath: /Madrid'

Request to VSTS REST API only works on Postman

I'm trying to run this request
curl -X POST \
'https://*****.visualstudio.com/DefaultCollection/_apis/wit/wiql?=&api-version=1.0' \
-H 'authorization: Basic *****' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: *****' \
-d '{
"query": "SELECT [System.Id] FROM WorkItems"
}'
but I keep getting this error
{"count":1,"value":{"Message":"A value is required but was not present in the request.\r\n"}}
It works as expected on Postman, so I think the request and the server are OK.
I'm trying to follow the first example shown here: https://www.visualstudio.com/en-us/docs/integrate/api/wit/wiql
Am I missing something?
The URL is wrong, remove =& from the REST API url and the url will be like this:
https://*****.visualstudio.com/DefaultCollection/_apis/wit/wiql?api-version=1.

Box -> View API -> Can not authenticate to create session

in this site :https://developers.box.com/view/
I do follow the instruction in the example (use Postman or curl)
curl https://view-api.box.com/1/sessions \
-H "Authorization: Token YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"document_id": "ABC123"}' \
-X POST
YOUR_API_KEY is replaced by my api key
ABC123 is replaced by a my pdf file.
But I got result: {"message": "Unsupported media type 'application/json, application/x-www-form-urlencoded' in request.", "type": "error", "request_id": "1f3d91c9489247579c78e7ceaa5e67c8"}
Please help me.
Thank you
It looks like there is an issue with the spaces after your \ characters. If you try:
curl https://view-api.box.com/1/sessions \
-H "Authorization: Token APIKEY" \
-H "Content-Type: application/json" \
-d '{"document_id": "DOCID"}' \
-X POST
It should work.