Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

….

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 that other Zephyr API operations use. For complete information on these, see Zephyr REST API.

Create an automation job

...

Respose codes

The API operations described below use the following operation:

POST http://<zephyr-server-address>/flex/services/rest/v4/upload-file/automation/create-job-detail

Request data

...

titleRequest body

The request body has an object wirh the following properties:

...

Property

...

Description

...

jobName

...

String. The name of the new job. It will identify the job in the product UI. This parameter cannot be an empty string.

...

projectId

...

Integer. The identifier of the project, to which the new job will post the results.

Expand
titleHow to get the project id

Log in to Zephyr, and select your project from the drop-down list on the top. You will see the project id in the URL:

Image Removed

...

releaseId

Integer. The identifier of the release, to which the new job will post the results.

...

titleHow to get the release id

...

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

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 proeprties of the job to be created.

Expand
titleJob properties

Property

Description

jobName

String. The name of the new job. It will identify the job in the product UI. This parameter cannot be an empty string.

projectId

Integer. The identifier of the project, to which the new job will post the results.

Expand
titleHow to get the project id

Log in to Zephyr, and select your project from the drop-down list on the top. You will see the release project id in the URL:

Image RemovedImage Added

automatedFrameworkreleaseId

String. The Integer. The identifier of the release, to which the new job will post the results.

Expand
titleHow to get the release id

Log in to Zephyr and select your project and release from the drop-down lists on the top. You will see the release id in the URL:

Image Added

automatedFramework

String. The automation framework to be used for the test run. Use the same values that the Automation Framework drop-down list in the product UI has.

cycleName

String. The name of the cycle to be used.

phaseName

String. The cycle phase to be used for the run.

jobDetailTcrCatalogTreeId

Integer. Id of the test case repository item.

testRepositoryPath

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 > symbol, for example, "Release 1.0 > new".

cycleStartDateStr,
cycleEndDateStr

Specifies the start and end dates of the cycle. as strings in the mm/dd/yyyy format.

IsReuse

true or false. Specifies if the test engine will use the same cycle for all the automation runs (true) or if it will create a new cycle for each run (false).

assignResultsTo

Integer. The id of the user to whom the test engine will assign results.

Expand
titleExample
Code Block
{
 "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",
 "phaseName": "new""
}

Response data

...

titleExample

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 that update job properties or delete a job.

Expand
titleExample

{
    "id": 1,
    "projectId": 5,
    "releaseId": 9,
    "automationFramework": "junit",
    "jobCrationDate": 1643879564994,
    "createdBy": "test test",
    "cycleDuration": 18,
    "isTimeStamp": false,
    "createPackage": false,
    "assignResultsTo": 1,
    "cycleName": "cycle",
    "phaseName": "new",
    "isReuse": true,
    "jobName": "Demo123",
    "testRepositoryPath": "Release 1.0 > new",
    "jobDetailTcrCatalogTreeId": 32,
    "cycleStartDateStr": "02/03/2022",
    "cycleEndDateStr": "02/21/2022",
    "jobSource": 2,
    "fileUplaodJobPath": "junit.xml",
    "timeStamp": false
}

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 that is an array of job identifiers to be used for the run

...

. You can find this identifier in the response of the operation that created the automation job.

Code Block
{"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.

Expand
titleExample
Code Block
[
    {
        "id": 1,
        "status": "new",
        "jobScheduleDate": 1643879667503,
        "cycleDuration": 0
    }
]

...

If the operation fails, it returns of the error codes.

Create and execute a job

The following operation creates a new job and command 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 name, project, release, cycle, and other properties of the created job. These are the values described above.

Expand
titleExample
Code Block
{
  "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",
  "phaseName": "new"
}

Response data

If the operation succeeds, the response status is 200 OK and the response body contains information on the scheduled run:

Expand
titleExample
Code Block
{
    "id": 20,
    "status": "new",
    "jobScheduleDate": 1643962371009,
    "cycleDuration": 0
}

Get job status

Stop or cancel a job

Update job properties

Get job properties

Get properties of several jobs

Use the following operation to get all job linked to the specified project and releaseIf the operation fails, it returns of the error codes.

Get job status

Use this operation:

GET http://{zephyr<zephyr-server-address}address>/flex/services/rest/v4/upload-file/automation/fileschedule/get-uploadlatest-job/list-progress?projectIdjobid={12}&releaseId={34ID}

Parameters

  • projectId - Integer. The Jira identifier of the desired project (not the project key).

  • releaseId - Integer. The Jira identifier of the desired release in that project.

Response data

...

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.

Expand
titleExample
Code Block
[
    {
            "id": 13 1,
        "projectId": 6,
        "releaseId": 11,
        "automationFramework": "junit",
        "status": "complete",
        "jobScheduleDate": 1643932800000,
        "createdBy": "Test Manager    "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

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 id property of the object 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 succeeded, the response status is 200 OK and the response body contains information on the specified job.

Expand
titleExample
Code Block
{
    "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,
    "timeStamp": false
}

If the operation fails, it returns of the error codes.

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 the response of the operation that created the automation job. Other properties of the object specify new values of the job properties. For information on them see above.

Expand
titleExample
Code Block
{
  "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",
  "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 of the error codes.

Get properties of several jobs

Use the following operation to get all job 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

projectID

Integer. The Jira identifier of the desired project (not the project key).

Expand
titleHow to get the project id

Log in to Zephyr, and select your project from the drop-down list on the top. You will see the project id in the URL:

Image Added

releaseID

Integer. The Jira identifier of the desired release in that project.

Expand
titleHow to get the release id

Log in to Zephyr and select your project and release from the drop-down lists on the top. You will see the release id in the URL:

Image Added

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.

Expand
titleExample
Code Block
[
    {
        "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",
        "cycleStartDatetestRepositoryPath": 1643932800000 "Release 1.0 > new",
        "cycleEndDateattachmentId": 1645401600000190,
        "jobNameattachmentName": "Demo123111"TESTMapAttachment.xml"
    },
    {
        "jobSourceid": 214,
        "jobDetailTcrCatalogTreeIdprojectId": 206,
        "phaseNamereleaseId": "new"11,
        "testRepositoryPathautomationFramework": "Release 1.0 > newjunit",
        "attachmentIdstatus": 190"complete",
        "attachmentNamejobScheduleDate": "TESTMapAttachment.xml"1643932800000,
     },   "createdBy": "Test {Manager",
        "idcycleStartDate": 141643932800000,
        "projectIdcycleEndDate": 61645401600000,
        "releaseIdjobName": 11"Demo123111",
        "automationFrameworkjobSource": "junit"2,
        "statusjobDetailTcrCatalogTreeId": "complete"20,
        "jobScheduleDatephaseName": 1643932800000"new",
        "createdBytestRepositoryPath": "Test ManagerRelease 1.0 > new",
        "cycleStartDateattachmentId": 1643932800000191,
        "cycleEndDateattachmentName": 1645401600000"TESTMapAttachment.xml"
    },
    {
        "jobNameid": "Demo123111"15,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > newqueued",
        "attachmentIdjobScheduleDate": 1911643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 151645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "queuednew",
        "jobScheduleDatetestRepositoryPath": 1643932800000 "Release 1.0 > new",
        "createdByattachmentId": "Test Manager"192,
        "cycleStartDateattachmentName": 1643932800000,"TESTMapAttachment.xml"
    },
   "cycleEndDate": 1645401600000, {
        "jobNameid": "Demo123111"16,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 1921643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"
    },
    {Test Manager",
        "idcycleStartDate": 161643932800000,
        "projectIdcycleEndDate": 61645401600000,
        "releaseIdjobName": 11"Demo123111",
        "automationFrameworkjobSource": "junit"2,
        "statusjobDetailTcrCatalogTreeId": "new"20,
        "jobScheduleDatephaseName": 1643932800000"new",
        "createdBytestRepositoryPath": "Test ManagerRelease 1.0 > new",
        "cycleStartDateattachmentId": 1643932800000208,
        "cycleEndDateattachmentName": 1645401600000, "TESTMapAttachment.xml"
    },
    {
        "jobNameid": "Demo123111"17,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 2081643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 171645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000 "Release 1.0 > new",
        "createdByattachmentId": "Test Manager"209,
        "cycleStartDateattachmentName": 1643932800000,"TESTMapAttachment.xml"
    },
   "cycleEndDate": 1645401600000, {
        "jobNameid": "Demo123111"18,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 2091643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 181645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000 "Release 1.0 > new",
        "createdByattachmentId": "Test Manager"210,
        "cycleStartDateattachmentName": 1643932800000,"TESTMapAttachment.xml"
    },
   "cycleEndDate": 1645401600000, {
        "jobNameid": "Demo123111"19,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 2101643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 191645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000 "Release 1.0 > new",
        "createdByattachmentId": "Test Manager"211,
        "cycleStartDateattachmentName": 1643932800000,"TESTMapAttachment.xml"
    },
   "cycleEndDate": 1645401600000, {
        "jobNameid": "Demo123111"20,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 2111643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 201645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000 "Release 1.0 > new",
        "createdByattachmentId": "Test Manager"212,
        "cycleStartDateattachmentName": 1643932800000,"TESTMapAttachment.xml"
    },
   "cycleEndDate": 1645401600000, {
        "jobNameid": "Demo123111"21,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 2121643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 211645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000"Release 1.0 > new",
        "createdByattachmentId": "Test Manager"213,
        "cycleStartDateattachmentName": 1643932800000, "TESTMapAttachment.xml"
    },
    "cycleEndDate": 1645401600000,{
         "jobNameid": "Demo123111"22,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 > new",
        "attachmentIdjobScheduleDate": 2131643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 221645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000"Release 1.0 > new",
        "createdByattachmentId": "Test Manager"214,
        "cycleStartDateattachmentName": 1643932800000,"TESTMapAttachment.xml"
    },
   "cycleEndDate": 1645401600000, {
        "jobNameid": "Demo123111"23,
        "jobSourceprojectId": 26,
        "jobDetailTcrCatalogTreeIdreleaseId": 2011,
        "phaseNameautomationFramework": "newjunit",
        "testRepositoryPathstatus": "Release 1.0 >  "new",
        "attachmentIdjobScheduleDate": 2141643932800000,
        "attachmentNamecreatedBy": "TESTMapAttachment.xml"Test Manager",
    },     {"cycleStartDate": 1643932800000,
        "idcycleEndDate": 231645401600000,
        "projectIdjobName": 6"Demo123111",
        "releaseIdjobSource": 112,
        "automationFrameworkjobDetailTcrCatalogTreeId": "junit"20,
        "statusphaseName": "new",
        "jobScheduleDatetestRepositoryPath": 1643932800000"Release 1.0 > new",
        "createdByattachmentId": "Test Manager"215,
        "cycleStartDateattachmentName": 1643932800000,
  "TESTMapAttachment.xml"
      "cycleEndDate": 1645401600000,
        "jobName": "Demo123111",
        "jobSource": 2,
        "jobDetailTcrCatalogTreeId": 20,
        "phaseName": "new"}
]

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 the response to the request that created that job:

Code Block
{
  "ids": [
    1,
    2,
    3,
   
"testRepositoryPath": "Release 1.0 > new", "attachmentId": 215, "attachmentName": "TESTMapAttachment.xml" } ]

...

 ...
  ]
}

If you need to delete just one job, specify only one id in the array, for example:

Code Block
{
  "ids": [
    12
  ]
}

Response data

The operation returns 200 OK, if the job or jobs have been deleted successfully. In case of an error, the operation returns one of the error codes.

See Also

ZBot Overview
Script Automation
Suite Automation
Folder Watcher
Create and Manage API Tokens in Zephyr