0

We actuly update xray test cases by doing a curl with JIRA username and password.

curl -H "Content-Type: application/json" -X POST -u JIRAUSERNAME:JIRAPASSWORD --data @"reports/cucumber.json" https://my.jira-url.com/rest/raven/1.0/import/execution/cucumber

Is there a way to use jira api tocken or some other kind of API key to avoid using username:password ?

1 Answer 1

2

If you're using Jira server/datacenter, Personal Access Tokens are now possible, as of Jira v8.14.

In terms of syntax, after creating the token, you can use it in your HTTP request using the "Authorization" header, having the value "Bearer <personal_access_token>" In terms of a "curl" request it would be something like

curl -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer <your_personal_access_token>"  https://my.jira-url.com/rest/raven/1.0/import/execution/cucumber

You can also see ahead a screenshot using RestMan.

RestMan example using a personal access token

Sign up to request clarification or add additional context in comments.

7 Comments

meanwhile we have updated the official docs at: docs.getxray.app/display/XRAY/REST+API
thank you Sérgio We are using an older version of jira. Is there a workaround for the older versions ?
The cloud version docs.getxray.app/display/XRAYCLOUD/REST+API, I notice wee can use Client Id and a Client Secret for authentication. This isn't available for the jira server?
Xray server/DC REST API is built on top of Jira's REST API. Xray Cloud has its own infrastructure, therefore it provides slightly different capabilities. Authentication based on client_id+client_secret is thus only available in Xray Cloud. My only recommendation is to update to a recent version (v8.14) of Jira, so you can take advantage of tokens.
Creating a token in JIRA just gives one string, it doesn't provide you with client_id and client_secret. How to use the token only for a Test Execution item in JIRA?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.