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.
Related
Good afternoon, everyone! Guys I'm going through a problem with basic authentication in Postman, I'll leave below details of what's going on. I need to send a Post so I can perform authentication and the server will return me a token bearer, but I'm taking a 400 error. I'll leave attached images of the Curl request and how I'm setting up in Postman.
Auth:
enter image description here
Body:
enter image description here
Reading the documentation I'm using I realized that I needed to perform a basic authentication using client_id and client_secret for me to be returned a token bearer, the same error is returned to me when I perform a request in curl. Could you help me with this mistake? Could you tell me where I'm going wrong?
Segue requisição curl:
curl -X 'POST' \
'https://portoapicloud-hml.portoseguro.com.br/oauth/v2/access-token' \
-H 'accept: application/json' \
-H 'Authorization: Basic NjZiNWJmMWI4MDE0NDExMWE1MGYwMWMyYmUxZjFiZDY6YzIwMGEwNzZlNmFkNDBkYThkYTkwODQ2YWI4OTI3MjU=' \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "client_credentials"
}'
I have a Metabase Docker image running locally that is routed to the URL:
https://metabase.example.com
I am trying to. do a curl on this to grab a Metabase token to use the Metabase API; however, this URL is hidden behind Google oauth, so I believe I need to first get a google oauth token for the test#company.com service account I am using which I can then pass to the curl request below.
curl --location --request POST 'https://metabase.example.com/api/session/google_auth' \
--header 'Content-Type: application/json' \
--data-raw '{"username": "test#company.com", "password": "password123"}'
Is there a simple way I can grab this Google Oauth token via CURL to then use in the above curl statement for metabase?
I can manually import execution result(report.json) through jira and its giving proper status.But i want to achieve through automation i am unable to do so
How to do so
i tried using below curl command in terminal ..was unable to get expected result
curl -H "Content-Type: application/json" -X POST -u username:password --data #report.json http://myurl.net/rest/raven/1.0/import/execution/cucumber
Note that the curl request you showed is tailored for Xray on Jira server and from the screenshot you're showing, it seems that you're using Xray on Jira Cloud. That requires that you have a token that you need to obtain first of all using another request.
If you're doing it by "hand" (i.e. from the command line), you would need to so something like:
token=$(curl -H "Content-Type: application/json" -X POST --data #"cloud_auth.json" https://xray.cloud.xpand-it.com/api/v2/authenticate| tr -d '"')
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token" --data #"report.json" https://xray.cloud.xpand-it.com/api/v2/import/execution/cucumber
My cloud_auth.json is something like:
{ "client_id": "215FFD69....","client_secret": "1c00f8f2c..." }
Please check in more detail the authentication API and the endpoint for importing cucumber results (there are two actually) in the cloud.
We are setting up a reporting feed to a client and, in testing out the endpoint, we are receiving different responses between cURL (command-line) and Postman. In Postman, the request goes through, just fine; we get a 200-OK back. However, when we send the request in cURL, we get the following response back curl: (60) SSL certificate problem: certificate has expired
With cURL
The cURL request looks like the following:
curl -i -H "content-type: application/json" -d '{"foo": [],"bar": [],"baz": []}' https://test.example.com/notARealEndpoint
With Postman
The Postman setup is hard to display, but it's code-conversion looks like:
cURL interpretation
curl --location --request POST 'https://test.example.com/not/aReal/Endpoint' --header 'Content-Type: application/json' --header 'Content-Type: text/plain' --data-raw '{"foo": [],"bar": [],"baz": []}'
*This, by the way, returns the same certificate has expired error when run in command line
HTTP interpretation
POST /not/aReal/Endpoint HTTP/1.1
Host: test.example.com
Content-Type: application/json
Content-Type: text/plain
{"foo": [],"bar": [],"baz": []}
Looks like the target server has an expired SSL certificate. The reason that postman is not raising an error couble be because of disabled SSL verification checks.
You can disable those checks in curl by using a --insecure or -k option.
eg:
curl https://expired.badssl.com
Will throw the same error that you are seeing.
versus
curl --insecure https://expired.badssl.com
will return an html response body.
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