Test Automation API
Prerequisites
Create a project and add the issue type Test to the project.
Retrieve an access key and a secret key. This can be done by navigating to the Zephyr menu and clicking on API keys.
Limitations
You cannot create test automation tasks for the Cucumber framework.
You cannot get the status of a single automation task.
ZBot jobs cannot be created through the API.
Generate JWT Token
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/jwt/generate
Request Header: Content-Type: application/json
Request Method: POST
Request Body:
{ "accessKey":"MDc0MzMwNDMtMTMyYi0zYTVjLWIwYzAtNjg2OTJiMTIwNDVjIDU1NzA1OCUzQWY0YTc5MzEyLTZhMmQtNDAxOS05ZDFlLTcwMTMyYTI2MWUyNiBVU0VSX0RFRkFVTFRfTkFNRQ", "secretKey":"SwZP386jHYMADQMAsIX3ZgsO7BGjfYx6FxVWU6gdknM", "accountId":"557058:f4a79312-6a2d-4019-9d1e-70132a261e26" }
Response Body:
JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1NTcwNTg6ZjRhNzkzMTItNmEyZC00MDE5LTlkMWUtNzAxMzJhMjYxZTI2IiwicXNoIjoiNzhmMDM2NzNjYWMzNDUxMjc5NDA5YTIyYjhmYWViNjFhNDQ1MzQzMDFiNDVhNDA0NGI2ODlmNmU1NjQwMzQzZCIsImlzcyI6Ik1EYzBNek13TkRNdE1UTXlZaTB6WVRWakxXSXdZekF0TmpnMk9USmlNVEl3TkRWaklEVTFOekExT0NVelFXWTBZVGM1TXpFeUxUWmhNbVF0TkRBeE9TMDVaREZsTFRjd01UTXlZVEkyTVdVeU5pQlZVMFZTWDBSRlJrRlZURlJmVGtGTlJRIiwiZXhwIjoxNTgyNTQ3MTk4LCJpYXQiOjE1ODI1NDM1OTh9.nwHTVBIsKQr1wQ_ppGDyf2UBoVxCwUfNx2iu8z_y2fE
Create Automation Task
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/create
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: POST
Request Body:
jobName:Job1 automationFramework:JUNIT cycleName:Cycle1 folderName:Folder1 appendDateTimeInCycleName:true/false appendDateTimeInFolderName:true/false versionName:Unscheduled projectKey:{projectKey} cycleStartingDate: cycleEndingDate: createNewCycle:true/false createNewFolder:true/false file:result.zip assigneeUser:assignee accountId jobDescription:Descriptions
Important
If you have mandatory fields in the Jira Create issue screen, you need to pass data for them in the request body. For example, if the Reporter field is mandatory, you need to add the following line to the request body:
mandatoryFields:{"reporter":{"label":"John Smith","name":"John Smith", "id":"557058:59b29c62-9138-4e8c-86c4-96c6df437d5c"}}
Response Body:
{ "message": "Job has been successfully created, Job id is : 726FAE2BD1280BCED437FE7582885F7CB1FE97C1A8D10ADEF6F1B1D239A51642" }
Execute Automation Task
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/execute
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: POST
Request Body:
jobId:{jobId}
Response Body:
{ "message": "Job executed successfully." }
Update Automation Task
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/update
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: PUT
Request Body:
jobId:{jobId} jobName:Job-edited automationFramework:JUNIT cycleName:Cycle1 folderName:Folder1 versionName:Unscheduled cycleStartingDate: cycleEndingDate: createNewCycle:true/false createNewFolder:true/false file:result.zip assigneeUser:assignee accountId jobDescription:Descriptions
Response Body:
{ "message": "Job has been successfully updated, Job id is : FAE1F0594E94069F9A8FCD80278EEA06818D671C6A46C397FE141F0B21D3A5F4" }
Get Automation Task Status
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/status/{JobId}
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: GET
Request Body: N/A
Response Body:
For a Successful Job: SUCCESS For a Failed Job:FAIL For a InProgress Job:IN PROGRESS
Get All Automation Tasks
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/list/{projectKey}
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: GET
Request Body: N/A
Response Body:
{ "jobName": "job11", "agentId": null, "jobDescription": " !@#$%^&*((()*)(*)(**(&(*&(*&*", "projectId": 10033, "versionId": 10067, "modifiedDate": null, "createdDate": 1582529598679, "automationFramework": "Test_Ng", "scriptPath": null, "invokeScript": null, "resultPath": null, "manualRun": null, "createPackage": false, "cycleName": "uftJOB1", "cycleId": null, "folderName": null, "folderId": null, "assigneeUser": "557058:621c5f3d-5d5b-40d6-85e8-0005f93349c6", "assigneeDisplayName": "Zephyr QA", "assigneeName": "Zephyr QA", "cycleStartDate": 1580544000000, "cycleEndDate": 1582272000000, "executionStatus": null, "currentStatus": "UNEXECUTED", "setFromFileWatcher": false, "automationVia": "Upload", "fileName": "UFT_Report_1002D4670BE84E75891B7D0B5B6B4542D6374D3BA6E5471316AB359896318E2816.xml", "fileDisplayName": "UFT_Report_10.xml", "accessKey": "MDc0MzMwNDMtMTMyYi0zYTVjLWIwYzAtNjg2OTJiMTIwNDVjIDU1NzA1OCUzQWY0YTc5MzEyLTZhMmQtNDAxOS05ZDFlLTcwMTMyYTI2MWUyNiBVU0VSX0RFRkFVTFRfTkFNRQ", "secretKey": "SwZP386jHYMADQMAsIX3ZgsO7BGjfYx6FxVWU6gdknM", "userKey": "557058:f4a79312-6a2d-4019-9d1e-70132a261e26", "accountId": "557058:f4a79312-6a2d-4019-9d1e-70132a261e26", "projectKey": null, "versionName": null, "agentName": null, "assigneeUserName": null, "createNewCycle": null, "createNewFolder": null, "jobId": null, "cycleStartingDate": null, "cycleEndingDate": null, "ctId": "6b855e21-46e7-4d35-810a-81482ef444c8", "autoJobId": "02D4670BE84E75891B7D0B5B6B4542D6374D3BA6E5471316AB359896318E2816" }
Delete Single Automation Task
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/{jobId}
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: DELETE
Request Body: N/A
Response Body:
Job has been deleted successfully.
Delete All Automation Tasks
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/delete/{projectKey}
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: DELETE
Request Body: N/A
Response Body:
All job has been deleted successfully.
Update Automation Task Status
Request URL: https://prod-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/status
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: PUT
Request Body:
jobId:{jobId} jobStatus:FAIL/SUCCESS/INPROGRESS
Response Body:
Status has been updated successfully.
Delete Multiple Automation Tasks at a Time
Request URL: https://qabench-vortexapi.zephyr4jiracloud.com/api/v1/automation/delete/jobs
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: DELETE
Request Body:
jobId:{jobId1,jobId2,jobId3} projectKey:{projectKey}
Response Body:
All job has been deleted successfully.
Get a Single Automation Task Information
Request URL: https://qabench-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/{jobId}
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: GET
Request Body: N/A
Response Body:
{ "jobName": "z2", "agentId": "C87B9520099B61E78CB76AD434327E67234B0E3C6514A389A26300302CD699C2", "jobDescription": null, "projectId": 10004, "versionId": -1, "modifiedDate": null, "createdDate": 1584970166331, "automationFramework": "Junit", "scriptPath": null, "invokeScript": null, "resultPath": "D:\\vortex\\Files\\Junit\\junit.xml", "manualRun": null, "createPackage": false, "cycleName": "junit cycle", "cycleId": "63d25096-5ebf-4b8d-be86-4461017824c3", "folderName": "folder", "folderId": "5a044524-441d-46f4-beba-6ce32232f98a", "assigneeUser": "557058:621c5f3d-5d5b-40d6-85e8-0005f93349c6", "assigneeDisplayName": "Zephyr QA", "assigneeName": "USER_DEFAULT_NAME", "cycleStartDate": 1584921600000, "cycleEndDate": 1584921600000, "executionStatus": "Job Executed Successfully", "currentStatus": "Success", "setFromFileWatcher": false, "automationVia": "ZBot", "fileName": null, "fileDisplayName": null, "accessKey": "NDhmYTExYzktYzQ4OS0zOWFjLThiM2YtZDk4MTUwNWI1NmY3IDU1NzA1OCUzQTYyMWM1ZjNkLTVkNWItNDBkNi04NWU4LTAwMDVmOTMzNDljNiBVU0VSX0RFRkFVTFRfTkFNRQ", "secretKey": "ZhYlrQ5V_3eoRVX8iSIEGl_g4UH1EFuBLss_GmNouDY", "userKey": "557058:621c5f3d-5d5b-40d6-85e8-0005f93349c6", "accountId": "557058:621c5f3d-5d5b-40d6-85e8-0005f93349c6", "projectKey": null, "versionName": null, "agentName": null, "assigneeUserName": null, "createNewCycle": null, "createNewFolder": null, "jobId": null, "cycleStartingDate": null, "cycleEndingDate": null, "modifiedBy": null, "createdBy": null, "executedOn": null, "autoScheduleDateTimePicker": null, "autoJobId": "8C688C99012BC87FE2855E4B458075FF17C3AD1B7CC82C68C4AEDA5986D34033", "ctId": "446d9d34-2597-4697-a7c2-d65cc66dd86c" }
Bulk Execute Automation Tasks
Request URL: https://qacloud-vortexapi.zephyr4jiracloud.com/api/v1/automation/bulk/job/execute
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: POST
Request Body:
jobId:{jobId1,jobId2,jobId3} projectKey:{projectKey}
Response Body:
Jobs are running
Save and Execute Automation Task
Request URL: https://qabench-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/saveAndExecute
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: POST
Request Body:
jobName:selenium automationFramework:Selenium (or any) cycleName:sele27api1 folderName:sele27api1 versionName:5.4.2 projectKey:NEW //cycleStartingDate:2020-02-20 (optional) //cycleEndingDate:2020-02-21 (optional) createNewCycle:false/true createNewFolder:false/true assigneeUser:assignee accountId //jobDescription:selenium job (optional)
Response Body:
{ "message": "Job has been created & executed successfully" }
Update and Execute Automation Task
Request URL: https://qabench-vortexapi.zephyr4jiracloud.com/api/v1/automation/job/updateAndExecute
Request Header: accessKey: {accessKey} / jwt: {jwt}
Request Method: PUT
Request Body:
jobName: Selenium automationFramework:Selenium (or any) cycleName:sele27api1 folderName:sele27api1 versionName:5.4.2 projectKey:NEW createNewCycle:false/true createNewFolder:falsetrue jobId: {jobid} which job user wants to update and execute jobDescription:Descriptions
Response Body:
{ "message": "Job has been updated & executed successfully" }