Â
Hi Atlassian/Xray community,
We're using Xray Server (not Cloud), and we're building a custom internal tool to manage test executions via API. Here's the context:
✅ What’s Working
I can successfully fetch test executions using:
<span>GET /rest/api/2/search?jql=Project=RTM AND issuetype='Test Execution'</span>
I can fetch the test cases linked to a test execution via:
<span>GET /rest/raven/1.0/api/testexec/{testExecutionKey}/test</span>I can fetch the testRunId of each test case using the value from:
<span>issue.fields.customfield_21623[].testRunId</span>
I can update the status of a test run with:
<span>PUT /rest/raven/1.0/api/testrun/{testRunId}
Body: { "status": "PASS" }</span>âś… This works perfectly and updates in Jira UI.
❌ What’s Not Working
I'm trying to upload .docx or .png files as evidence to a test run using the endpoint:
<span>POST /rest/raven/1.0/api/testrun/{testRunId}/attachments</span>Â I get the following error response:
<span><status>
<status-code>404</status-code>
<message>null for uri: https://mycompanyjira.com/rest/raven/1.0/api/testrun/2572671/attachments</message>
</status></span>
This happens even though:
The test run ID is valid (verified via /api/test-runs)
The test run has manual steps (we assume — but not 100% sure)
The evidence files are small and standard (e.g., .docx, .png)
🔄 What I Tried Instead
To work around the issue, I also attempted using:
Â
<span>POST /rest/raven/1.0/import/execution</span>
 With this payload:
Â
<span>{
"testExecutionKey": "RTM-622283",
"tests": [
{
"testKey": "RTM-623929",
"status": "PASS",
"evidences": [
{
"data": "base64encoded",
"filename": "test.docx",
"contentType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
]
}
]
}</span>But this also fails silently or does not attach the evidence, even though the status is updated.
âť“ Questions for the Community
Does POST /testrun/{id}/attachments only work if the test run has manual steps?
Are there any permissions or configurations required on the Jira/Xray side to allow attachments via API?
Should we be using POST /import/execution for uploading evidence instead — and if so, does it overwrite the execution or merge?
What is the recommended way to programmatically upload evidence to each test case inside a test execution on Xray Server?
Any help or clarification would be greatly appreciated!
Thanks 🙏
— Aryan