API Operations for Automation Jobs
Base URL, authentication, data formats
The operations described below work for both Cloud and On-Premise instances of Zephyr Enterprise. They use the same authentication parameters and data formats as other Zephyr API operations. For complete information on these, see Zephyr REST API.
Response codes
The API operations described below use the following response codes:
Response code | Description |
|---|---|
200 | The operation has been completed successfully. |
400 | Error in request data or parameters. For instance, the project or job with the specified ID doesn’t exist. |
401 | Authentication error (authentication token is missing). |
403 | Error. You don’t have permissions to perform this operation. |
500 | Internal server error. |
Create an automation job.b
To create a new automation job, use this operation:
POST http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/create-job-detail
Request data
The request body specifies properties of the job to be created.
Job properties:
Property | Description |
|---|---|
| String. The name of the new job. It will identify the job in the product UI. This parameter cannot be an empty string. |
| Integer. The new job will post the result to the project's identifiers. How to get the project ID: Log in to Zephyr, and select your project from the list at the top. You will see the projectID in the URL: ![]() |
| Integer. The identifier of the release to which the new job will post the results. How to get the release ID: Log in to Zephyr and select your project and release from the drop-down lists at the top. You will see the release ID in the URL: ![]() |
| This field specifies the environment in which the tests are executed or run. It is a mandatory option only if you have selected it in the Test Repository Configuration under Administration and Customization. |
| String. The automation framework is to be used for the test run. Use the same values as the Automation Framework list in the product UI. |
| String. The name of the cycle to be used. |
| String. The cycle phase to be used for the run. |
| Integer. Id of the test case repository item. |
| The Zephyr test repository that contains the tests to be executed. Use the names as they are shown in the product UI. Separate levels with the |
| Specifies the start and end dates of the cycle as strings in the mm/dd/yyyy format. |
|
|
| Integer. The ID of the user to whom the test engine will assign results. |
Example:
fileName: "result-file.xml"
automationJobDetail:{
"releaseId": 5,
"jobName": "Demo123",
"automationFramework": "junit",
"cycleName": "cycle",
"jobDetailTcrCatalogTreeId": 32,
"projectId": 9,
"testRepositoryPath": "Release 1.0 > new",
"cycleStartDateStr": "02/03/2022",
"cycleEndDateStr": "02/21/2022",
"isReuse": true,
"assignResultsTo": "1",
"environment": "qademo_mysql",
"phaseName": "new"
}
Response data
If the operation succeeded, the response has the 200 OK status, and the response body contains the created job properties. The id property is the job's identifier. You can use it later in operations to update job properties or delete a job.
Example:
{ "id":1, "releaseId": 5, "jobName": "Demo123", "automationFramework": "junit", "cycleName": "cycle", "jobDetailTcrCatalogTreeId": 32, "projectId": 9, "testRepositoryPath": "Release 1.0 &gt; new", "cycleStartDateStr": "02/03/2022", "cycleEndDateStr": "02/21/2022", "isReuse": true, "assignResultsTo": "1", "environment": "qademo_mysql", "phaseName": "new" }
If the operation failed, it returns one of the error codes.
Schedule a job run
To schedule the run of one or multiple jobs, use the following operation:
POST http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/execute-job
Request data
The request body contains an object with the IDs property and an array of job identifiers to be used for the run. You can find this identifier in the operation's response that created the automation job.
{"ids":[1, 2, 3]}Response data
If the operation succeeds, the response code is 200 OK, and the response body contains information on the scheduled run. The id property is the identifier of the run. You can use it later to check the job status, or to stop or cancel a job.
Example:
[
{
"id": 1,
"status": "new",
"jobScheduleDate": 1643879667503,
"cycleDuration": 0
}
]If the operation fails, it returns an error code.
Create and execute a job
The following operation creates a new job and commands the test engine to run it:
POST http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/create-and-execute-job
Request data
The request body specifies the created job's name, project, release, cycle, and other properties, which are the values described above.
Example:
fileName: "result-file.xml"
automationJobDetail:{
"releaseId":11,
"jobName": "Demo123111",
"automationFramework": "junit",
"cycleName": "cycle",
"jobDetailTcrCatalogTreeId": 20,
"projectId": 6,
"testRepositoryPath": "Release 1.0 > new",
"cycleEndDateStr": "02/21/2022",
"cycleStartDateStr": "02/04/2022",
"isReuse": true,
"assignResultsTo": "1",
"environment": "qademo_mysql",
"phaseName": "new"
}Response data
If the operation succeeds, the response status is 200 OK and the response body contains information on the scheduled run:
Example:
{
"id": 20,
"status": "new",
"jobScheduleDate": 1643962371009,
"cycleDuration": 0
}If the operation fails, it returns an error code.
Get job status
Use this operation:
GET http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/schedule/get-latest-job-progress?jobid={ID}
Request data and URL parameters
The request body is not used. The jobid parameter in the URL specifies the identifier of the job whose status you want to check. You get this identifier in the response to the operation that created the job.
Response data
If the operation succeeds, the response status is 200 OK , and the response body has information on the job and its cycle.
Example:
{
"id": 1,
"automationJobDetailId": 1,
"status": "complete",
"jobScheduleDate": 1643879667000,
"cycleId": 4,
"cycleDuration": 0
}In case of an error, the operation returns one of the error codes.
Stop or cancel a job.b
Use the following operation:
POST http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/cancel/{ID}
Request data and URL parameters
The request body is not used. The ID parameter in the URL is the identifier of the scheduled run. You can find it in the response to the operation that scheduled the job run—it’s the object's ID property in the response body.
Response data
If the operation succeeds, the response status is 200 OK, and the response body contains true.
If the operation fails, it returns one of the error codes.
Get job properties
Use the following operation to get properties of an automation job:
GET http://<zephyr-server-address>/flex/services/rest/v3/automation/job/detail?jobid={ID}
Request data and URL parameters
The request body is not used. The jobid parameter in the URL specifies the identifier of the desired job. You get this identifier in a response to the operation that created the job.
Response data
If the operation succeeds, the response status is 200 OK, and the response body contains information on the specified job.
Example:
{
"id": 1,
"projectId": 5,
"releaseId": 9,
"automationFramework": "junit",
"invokeScript": false,
"jobCrationDate": 1643879564000,
"createdBy": "test test",
"cycleDuration": 18,
"isTimeStamp": false,
"createPackage": false,
"assignResultsTo": 1,
"cycleStartDate": 1643846400000,
"cycleEndDate": 1645401600000,
"cycleName": "cycle",
"phaseName": "new",
"isReuse": true,
"jobName": "Demo123",
"testRepositoryPath": "Release 1.0 > new",
"jobDetailTcrCatalogTreeId": 32,
"isDateStr": false,
"jobSource": 2,
"fileUplaodJobPath": "junit.xml",
"userId": 7,
"environment": "qademo_mysql",
"timeStamp": false
}If the operation fails, it returns an error code.
Update job properties
Use the following operation:
POST http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/update-execute-job
Request data
To specify new values of the job properties, you pass a JSON object in the request body. The id property of this object specifies the job to be updated. You can get this ID in response to the operation that created the automation job. Other properties of the object specify new values of the job properties. For information on the m, see above.
Example:
fileName: "result-file.xml"
automationJobDetail:{
"id": 8, <-- job ID
"releaseId": 18,
"jobName": "Demo1",
"automationFramework": "junit",
"cycleName": "cycle",
"jobDetailTcrCatalogTreeId": 34,
"projectId": 7,
"testRepositoryPath": "Release 1.0 > testrepo",
"cycleEndDateStr": "02/21/2022",
"cycleStartDateStr": "02/15/2022",
"isReuse": true,
"assignResultsTo": "1",
"environment": "qademo_mysql",
"phaseName": "testrepo"
}Response data
If the operation succeeds, the response status is 200 OK, and the response body contains a JSON object with updated job properties.
If the operation fails, it returns an error code.
Getthe properties of several job.s
Use the following operation to get all jobs linked to the specified project and release:
GET http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/file-upload-job/list?projectId={projectID}&releaseId={releaseID}
Request data and URL parameters
The request body is not used. The URL has the following parameters:
Parameter | Description |
|---|---|
| Integer. The Jira identifier of the desired project (not the project key). How to get the projectID: Log in to Zephyr, and select your project from the list at the top. You will see the project ID in the URL: ![]() |
| Integer. The Jira identifier of the desired release in that project. How to get the releaseID: Log in to Zephyr and select your project and release from the drop-down lists at the top. You will see the releaseID in the URL: ![]() |
Response data
If the operation succeeds, the response status is 200 OK, and the response body has a JSON array with information on all the jobs created for the specified project and release.
Example:
[
{
"id": 13,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "complete",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 190,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 14,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "complete",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 191,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 15,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "queued",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 192,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 16,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 208,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 17,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 209,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 18,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 210,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 19,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 211,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 20,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 212,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 21,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 213,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 22,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 214,
"attachmentName": "TESTMapAttachment.xml"
},
{
"id": 23,
"projectId": 6,
"releaseId": 11,
"automationFramework": "junit",
"status": "new",
"jobScheduleDate": 1643932800000,
"createdBy": "Test Manager",
"cycleStartDate": 1643932800000,
"cycleEndDate": 1645401600000,
"jobName": "Demo123111",
"jobSource": 2,
"jobDetailTcrCatalogTreeId": 20,
"phaseName": "new",
"testRepositoryPath": "Release 1.0 > new",
"attachmentId": 215,
"attachmentName": "TESTMapAttachment.xml"
}
]If the operation fails, it returns one of the error codes.
Delete a job
Use this operation:
POST http://<zephyr-server-address>/flex/services/rest/v3/automation/job/delete
The request body specifies the jobs to be deleted.
Request data
The request body contains identifiers of jobs to be deleted. These are identifiers you get for a job in response to the request that created that job:
{
"ids": [
1,
2,
3,
...
]
}
If you need to delete just one job, specify only one ID in the array, for example:
{
"ids": [
12
]
}Response data
The operation returns 200 OK if the job or jobs have been deleted successfully. If an IIfan error occurs, it returns one of the error codes.

