I'm trying out the IBM Db2 REST Service but I get an Error during the activation of the Rest Service:
I followed the Documentation
I have pulled and run db2rest from IBM container registry, started it and could
do a rest call to get a token:
curl -k -X POST \
https://127.0.0.1:50050/v1/auth \
-H "content-type: application/json" \
-d '{
"dbParms": {
"dbHost": "172.17.0.2",
"dbName": "TESTDB",
"dbPort": 50000,
"isSSLConnection": false,
"username": "db2inst1",
"password": "db2inst1"
},
"expiryTime": "30m" }'
Then i wanted to activate the rest capability:
curl -k -X POST \
https://127.0.0.1:50050/v1/metadata/setup \
-H "authorization: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZSwiY2xpZW50X2lkIjoiMjMxMTAzODgtZmM4OC00NzIwLTg2NTQtNTk5OWM2MjRkMGE0IiwiZXhwIjoxNjAxODI1ODYzLCJpc3MiOiJkYjJpbnN0MSJ9.ZHtsviWUbApw6y-72o5ey7LFf3ys2KEP2jAf7u_36Vq5ASnhKISeIzLXIN5a-OrIasZsQkVjAI5D-9o8Hlilk3mnMVF6XBu5VU7mHZb7k8fnQh75Fk770uCZwlPpgUqcluz6TIcPzUVEmzY5k9uTxWw2-F7Aqi0ruEMV2CBf8iU7KoG1b9apaeqQkY2MI7eSkKiupwkoRCxhF2LMSUUCDZUPMlspN80B5aZ5bUov4o1-j1fS7-_Scm24C4tm6jkwNdNj2CIN7xv6moUjU1oIxzHwbIKLJs6VJARFqLlLLnk9VoINSA1q6X6T9di7tfyqouxPGFagnjtphadNpCfXfg" \
-H "content-type: application/json" \
-d '{
"schema": "DB2REST"
}'
And i got the Error:
{"errors":[{"code":"internal_server_error","message":"[Db2 REST] Setup metadata failed.","more_info":"SQLExecute: {42601} [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "#" was found following ".RESTLISTSERVICES(IN". Expected tokens may include: ",". LINE NUMBER=1. SQLSTATE=42601\n"}],"trace":null}
I get the same Error with:
docker exec db2rest /opt/ibm/dbrest/scripts/db2rest-setup.sh 127.0.0.2 testdb 50000 N DB2REST db2inst1 db2inst1
Any Ideas where the Problem could be ?
Related
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'
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
i try to get servers status of distributed version of OrientDB via http rest :
curl --user admin:admin --header "Accept: text/csv" -d "list servers " "http://localhost:2480/command/GratefulDeadConcerts/sql"
doesnt works :
{
"errors": [
{
"code": 500,
"reason": 500,
"content": "com.orientechnologies.orient.core.command.OCommandExecutorNotFoundException: Cannot find a command executor for the command request: sql.list servers\u000d\u000a\u0009DB name=\"GratefulDeadConcerts\""
}
you're sending a list servers command to the sql interpreter while that's not a sql command but a console one.
UPDATE
you can use this
curl --user root:root --header "Accept: text/csv" -d "HA STATUS -servers -output=text" "http://localhost:2480/command/GratefulDeadConcerts/sql"
Run this command to get the results as JSON that contains all servers (nodes) with detailed status and info per server:
curl -X POST --user {{user}}:{{password}} --header "Accept: application/json" \
-d "HA STATUS -servers -db" "{{orientdb-url}}:2480/command/{{database-name}}/sql"
I have an AWS EC2 Instance running Ubuntu. I have installed Parse Server on it and it runs on localhost.
I've added a new object to the server using this command:
$ curl -X POST \
-H "X-Parse-Application-Id: APPLICATION_ID" \
-H "Content-Type: application/json" \
-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \
http://localhost:1337/parse/classes/GameScore
After I've added this sample object, I used this command in order to get that object back:
$ curl -X GET \
-H "X-Parse-Application-Id: APPLICATION_ID" \
http://localhost:1337/parse/classes/GameScore/2ntvSpRGIK
And I got this output, which means that it is on the database:
{
"objectId": "2ntvSpRGIK",
"score": 1337,
"playerName": "Sean Plott",
"cheatMode": false,
"updatedAt": "2016-03-11T23:51:48.050Z",
"createdAt": "2016-03-11T23:51:48.050Z"
}
But for some reason, the class GameScore isn't being shown not on the Parse dashboard and not on my migrated database on MongoDB. The MongoDB is on the same server as the Parse Server.
Is it okay or there is a problem?
I solved it by adding the database Uri
--databaseURI <DatabaseURI>
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.