I'm trying to import an xml report to Jira xRay - to a Test Execution item.
The documentation I can find makes reference to client_id and client_secret, which should be generated by Create API key. Create API key only generates one string, a token.
As such I can't figure out how to use just the token to submit the xml report.
For example, this command:
curl -H "Content-Type: application/json"
-X POST
--data @"cloud_auth.json"
https://xray.cloud.getxray.app/api/v2/authenticate
I can't use it, as it needs client_id and client_secret. Also, the endpoint itself returns
Cannot GET /api/v2/authenticate
Using this command:
curl -H "Content-Type: text/xml"
-X POST
-H "Authorization: Bearer $token"
--data @"data.xml"
https://xray.cloud.getxray.app/api/v1/import/execution/junit?testExecKey=XNP-23
from Xray docs about JUnit XML results Multipart results in
"{"error":"Invalid JWT: JsonWebTokenError: jwt malformed"}"
Please can anyone help?
first you need to clarify if you're using Xray on Jira server/datacenter or Jira Cloud, because they are different products and have slightly different APIs; besides Jira Cloud and Jira server/datacenter are also different products. To find out, you can ask your Jira admin for example.
If you’re using Xray Cloud, then this is documentation site. In this case, in order to submit the JUnit XML report you need to make an authencation with a client id and client secret that you obtain on Xray API Keys section. The authentication request is detailed here, and that will return a token that you'll use on the second request. The second request is an HTTP POST, as described here, and you need to pass the token obtained earlier. The main REST API documentation site is this one.
If you’re using Xray on Jira server/datacenter, then this is proper documentation site. In Xray server, the authentication mechanism is provided by Jira itself. You can either use basic authentication or Personal Access Tokens (if you have Jira >= 8.14). This is detailed on Xray server/datacenter page dedicated to its REST API. After choosing the authentication mechanism to use, you just need to make a HTTP POST request as detailed here.
There is an open-source GitHub project with some code snippets, both for Xray server/datacenter and cloud, using different test automation report formats and different authentication mechanisms.