'Login with postman with xray cloud API
I have problems with Postman and xray cloud API I seek on THE WEB and I have some errors because of the authentification. I try to fix it on postman but I don't find the correct way. I use API token and I see that a lot of users use mail: API encoded on base64 on the header. I don't see how in the API how to settle this.
If someone has a way or a tutorial with clear path
- I have this on my prerequest script. I use for client id and client secret an API token create for JIRA xray.
- My user is admin
- I've got with a post request with authenticate a status 200 OK with an authorization token but for the others request I have all ways the error beside
For example GET {{JIRA_BASEURL}}/rest/api/2/project/{{PROJECT_KEY}} (when I put directly this request on a navigatot I have a response) but with postman
"errorMessages": [
"No project could be found with key 'SCRUM'."
],
"errors": {}
}
My prerequest script
pm.sendRequest({
//url: pm.environment.get("api-url") + 'v2/authenticate',
url: 'https://xray.cloud.getxray.app/api/v2/authenticate',
method: 'POST',
header: {
'content-type': 'application/json',
client_id: pm.environment.get("client_id"),
client_secret: pm.environment.get("client_secret")
},
body: {
mode: 'raw',
raw: JSON.stringify({ client_id: pm.environment.get("client_id"), client_secret: pm.environment.get("client_secret") })
}
}, function (err, res) {
pm.environment.set("AUTH_TOKEN", res.json());
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
