Attachment Support in Automation API
You can submit test results with attachments using the create-and-execute-job-with-attachments API. This API works the same way as the existing create-and-execute-job API, with additional support for uploading attachment files along with the test results. The API supports uploading multiple attachment files in a single request.
The API also supports creating and scheduling automation jobs, similar to the create-and-execute-job API.
API Endpoint
POST /rest/v4/upload-file/automation/create-and-execute-job-with-attachments
Prerequisite
- The result file must reference the attachment file names.
Attachment Guidelines
-
Reference only the attachment file name in the result file.
-
Do not include the full file path.
Example
Correct:
image.pngIncorrect:
C:\attachments\image.png
cURL Example
curl --location 'https://qamssql.dev.yourzephyr.com/flex/services/rest/v4/upload-file/automation/create-and-execute-job-with-attachments' \
--header 'Authorization: Basic dGVzdC5tYW5hZ2VyOnubWFuYWdlcg==' \
--header 'Cookie: token=7f344463-55c3-4880-b6df-86bb726d43c0' \
--form 'fileName=@/D:/zephyr/Cucumber/cucumberAPI.xml' \
--form 'automationJobDetail={
"releaseId": 20,
"jobName": "demo 1",
"automationFramework": "cucumber",
"cycleName": "cucumber",
"jobDetailTcrCatalogTreeId": 59,
"projectId": 9,
"testRepositoryPath": "Release 1.0 > API",
"cycleEndDateStr": "02/07/2026",
"cycleStartDateStr": "02/02/2026",
"isReuse": true,
"assignResultsTo": -10,
"phaseName": "API",
"environment": "cucumber"
}' \
--form 'attachments=@/C:/Users/Screenshots/Screenshot 2026-01-28 131206.png' \
--form 'attachments=@/C:/Users/Screenshots/Screenshot1.png' \
--form 'attachments=@/C:/Users/Screenshots/Screenshot2.png'
Cucumber XML Example with Attachment
A sample XML file with the attachment tag for Cucumber results appears as follows:
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="cucumber.runtime.formatter.JUnitFormatter" skipped="0" tests="1" time="0.449278">
<testcase classname="Test case 1" name="Test case 1" time="360">
<system-out><![CDATA[Given Chrome browser should be opened..................passed
When Zephyrcodecontest website is launched..................................passed
]]></system-out>
<attachments>
<attachment>Screenshot 2026-01-28 131206.png</attachment>
<attachment>Screenshot2.png</attachment>
<attachment>Screenshot3.png</attachment>
</attachments>
</testcase>
</testsuite>