How to upload xml test result to JIRA uses XRAY plugin.

Pavankumar April 1, 2024

Hello Team 

Earlier I used below command to upload robot test result successfully to jira uses xray plugin 

curl -H "Content-Type: multipart/form-data" -u user:passwd -F "file=@output.xml" https://jira.domain-name.com/rest/raven/1.0/import/execution/robot?projectKey=XXXX

Recently, My jira server moved to cloud and url got changed to

https://domain-name.atlassian.net/jira/software/  then i changed the rest api command to 
curl -H "Content-Type: multipart/form-data" -u user:passwd -F "file=@output.xml" https://domain-name.atlassian.net/jira/rest/raven/1.0/import/execution/robot?projectKey=XXXX

But the result is not getting uploaded and results in failure as below :

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops, you&#39;ve found a dead link. - JIRA</title><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><script src='/static-assets/metal-all.js'></script><meta name="decorator" content="none" /></head><body class=" error-page error404"><script type="text/javascript">document.body.className += " js-enabled";</script><div id="page"><header id="header" role="banner"></header><!-- #header --><section id="content" role="main"><div class="aui-page-panel"><div class="aui-page-panel-inner"><section class="aui-page-panel-content lowerContent"><div id="error-state"><span class="error-type"></span><h1>Oops, you&#39;ve found a dead link.</h1><ul><li>Go back to the <a href="javascript&colon;window.history.back()">previous page</a></li><li>Go to the <a href="/secure/MyJiraHome.jspa">Home Page</a></li></ul></div></section><!-- .aui-page-panel-content --></div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --></section><!-- #content --><footer id="footer" role="contentinfo"><section class="footer-body">


<ul class="atlassian-footer">
<li>
Atlassian JIRA <a class="seo-link" href="https://www.atlassian.com/software/jira">Project Management Software</a>

 

<span id="footer-build-information">(v1001.0.0-SNAPSHOT#100248-<span title='d2a8619c534a6b3769f470bb97e8df1ebd06aed7' data-commit-id='d2a8619c534a6b3769f470bb97e8df1ebd06aed7}'>Rev:d2a8619</span>)</span>
</li>
<li>
<a id="about-link" href="/secure/AboutPage.jspa">About JIRA</a>
</li>
<li>
<a id="footer-report-problem-link" href="/secure/ContactAdministrators!default.jspa">Report a problem</a>
</li>
</ul>
<div id="footer-logo"><a href="http://www.atlassian.com/" rel="nofollow">Atlassian</a></div></section></footer><!-- #footer --></div><!-- #page --></body></html>

Please suggest is there any changes required in the uploading api command or any other.
Thanks.

1 answer

0 votes
Pavankumar April 7, 2024

create a token using xray client id and secret key and export it as shell variable.
Use curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token" --data @"output.xml" https://xray.cloud.getxray.app/api/v2/import/execution/robot?projectKey=XXX

to upload test result to JIRA.

Suggest an answer

Log in or Sign up to answer