I have a question about how can I configure -H "Host: my.host.com" from gateway to my api.
I have the following logic:
I try to cover, for example, my-api.net via apiman-gateway.
For example, I can do the following direct call to my api like 'curl -X GET --header 'Accept: */*' -H "Host: www.google.com" 'http://my-api.net/accounts?accountNumber=12314123'.
Based on this call, my api will know, that my consumer is google for example. But once I try to make a call via apiman-gateway 'curl -X GET --header 'Accept: */*' -H "Host: www.google.com" 'http://apiman-gateway/GoogleOrganization/API/V1/accounts?accountNumber=12314123', the host is not possible to pass, and implementation of my api tells me that it does not know any host name like already deployed my-api.net. Probably someone can tell me how can I set up for example via policy, probably just to make a call from apiman-gateway to my api with the host parameters like above?
Related
I am able to login my local (and remote server) with the following curl (which I generated using Postman)... and I can login successfully using another API Client (Rested) with the same params/headers/body that I am trying to use in Postman. I've turned off "SSL cert verification" and "Send Postman Token header" in settings (per other Stack Overflow answers).. but still getting an unauthorized response from server when using Postman (but not when using curl or Rested)
curl:
curl -X POST \ http://localhost:8080/api/user/login \ -H 'Accept:
application/json' \ -H 'Content-Type: application/json' \ -d '{
"email": "email#example.com",
"password": "examplemail**" }'
And here is my log..
I just solved my own Q.. and posting this answer because I've seen other questions re: curl working but postman not on SO and Postman communities. My solution was to check the Content-Length header and Connection headers. They were auto populating anyway, so after 'accepting' them as headers, the Postman request worked. Here is a screenshot of the headers that worked.
Please be kind and tell me how to execute the following CURL command with REST API Call node from Thingsboard 2.5.2:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"username":"tenant#thingsboard.org", "password":"mypassword"}' 'http://127.0.0.1:8080/api/auth/login'
How can I send the -d '{"username":"tenant#thingsboard.org", "password":"mypassword"}' to the REST API CALL node ?
Thank You !
As described on the documentation page, the first step is indeed to POST on /api/auth/login providing a username and password in order to retrieve a JWT token. This is the first step you described in your curl call.
Then, for further calls to other API endpoints, you must send a X-Authorization HTTP header with the Bearer: $TOKEN as a value.
Note that if you want to interact with the Thingsboard administration API with Java or Python, clients are available to abstract this.
I am trying to write two different messages to the same subject bot after each other. But any time a new subject with the same title is posted.
I use the rest api post call and tried this:
curl --insecure -X POST https://yourcircuit.com/rest/v2/webhooks/incoming/xxxx -d '{"text": "foobar1", "subject": "My fancy title"}'
curl --insecure -X POST https://yourcircuit.com/rest/v2/webhooks/incoming/xxxx -d '{"text": "foobar2", "subject": "My fancy title"}'
I assumed two messages under the same title box inside the circuit conversation.
What is shows:
What I want to achive:
Does anybody know how to achive this?
That is not supported with webhooks. This could be done with the regular REST API /conversations/{convId}/messages/{itemId}. See https://circuitsandbox.net/rest/v2/swagger/ui/index.html
You can try this using the swagger ui at https://circuitsandbox.net/rest/v2/swagger/ui/index.html
Here is the corresponding http request:
curl -X POST "https://circuitsandbox.net/rest/v2/conversations/05bd75f1-a8d5-40c0-b24a-28710ec1a57f/messages/cde0b57e-7f1d-4ffb-b2af-a1b7c7c9fa06" \
-H "accept: application/json" \
-H "authorization: Bearer ot-4f70c19edc6f43c4b89b4d39b4440000" \
-H "content-type: application/x-www-form-urlencoded" \
-d "content=hello"
Note that the token above has been invalidated. You need to use your own conversation ID, parent item ID and access token.
And here is how it looks in Circuit:
I am attempting to connect to the Rundeck API using CURL but I am getting a 401 Unauthorized error:
curl --insecure --location --request GET 'https://rundeck.example.com' --header 'Accept: application/json' --header 'X-Rundeck-Auth-Token: xyz'
401 Authorization Required
Authorization Required This server could not verify that
you are authorized to access the document requested. Either you
supplied the wrong credentials (e.g., bad password), or your browser
doesn't understand how to supply the credentials required.
Apache/2.2.15 (Oracle) Server at rundeck.example.com Port
80
If I try it using my username, it works.
curl --insecure --location -u 123456789 -p password --request GET 'https://rundeck.example.com' --header 'Accept: application/json' --header 'X-Rundeck-Auth-Token: xyz'
I created the auth token on Rundeck using my personal user that has admin privileges.
Please note that I have set up LDAP at web server level (httpd.conf) and control user access from there.
To access API you need to specify some action (for example: run a job, get metrics, etc.)
For example, get the instance metrics:
curl --location --request GET "http://yourhost:4440/api/34/metrics/metrics" --header "Accept: application/json" --header "X-Rundeck-Auth-Token: C8nVU5AhdzpQ8ucBeMG1ITFvSfaKCw6u"
Here you have a lot of examples.
I am new to openstack, trying to use Ceilometer python API to pull some data from a testbed server, I am accessing the server from a remote site
the problem is that I cannot figure out how get the an authorization token
I used the following command
curl -i 'http://HOST:8774/' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d/tokens auth": {"tenantName": "project", "passwordCredentials": {"username": "user", "password": "password"}}}'
But it does not give me anything,
curl -X GET -H "X-Auth-Token:$MY_TOKEN" http://HOST:8774/tokens
also does not give me any token
From your use of port 8774 I suspect you might be using DevStack. Try this
curl -s -X POST http://$OPENSTACK_KEYSTONE_HOST:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"my-username", "password":"my-password"}, "tenantName":"my-tenantName"}}
In DevStack Keystone (the auth service you get tokens from) is running on port 5000 by default. This may or may not be true in your case. Ask your friendly OpenStack operator what host (and port) Keystone is running on and put that in place of $OPENSTACK_KEYSTONE_HOST:5000