Archive Test Executions API
Using Zephyr Squad Server REST API, you can access test execution data and manage test executions including archiving and unarchiving them.
Overview
Authentication
This API uses Basic authentication with your Jira username and password. Authentication is done by setting the following header for all the requests:
Authorization: Basic TOKEN
Where TOKEN
is a base64-encoded string username:password. For example, if your login is admin and your password is qwerty123456, you need to Base64-encode the string admin:qwerty123456, which gives you YWRtaW46cXdlcnR5MTIzNDU2. The final header will be as follows:
Authorization: Basic YWRtaW46cXdlcnR5MTIzNDU2
If you use cURL to send requests, use the -u
flag to specify your username and password:
curl -u "admin:qwerty123456" https://...
JSON format
This API uses JSON as the data format for requests and responses. POST and PUT requests containing a JSON request body must include the Content-Type
header:
Content-Type: application/json
Response codes
200 - Success, the request was accepted and processed successfully.
400 - Bad request, check the error message in the response body.
401 - Unauthorized, ensure that the request is authenticated with the correct username and password, and that the credentials were provided in the expected format.
403 - Forbidden, ensure that the permissions required to execute this command were provided.
404 - Not found, check the API URL.
500 - Internal server error, ensure that the server is up, and Zephyr Squad is configured correctly for using the API.
Archive executions
Choose test executions to be archived by IDs.
jobProgressToken
- the token to track the job status.Use the GET
method to get the status of the scheduled job. The type of the job progress token: bulk_executions_archive_job_progress
.
Restore archived executions
Choose test executions to be restored by IDs.
This returns jobProgressToken
which is used to fetch the scheduled job status.
Request
POST http(s)://<SERVER>/rest/zapi/latest/execution/restore
Request body:
{ "executions": [ "id1", "id2", ....., "idn" ] }
Where id1 - idn
are the IDs of the test executions that you want to archive.
Response
Response body
{ "jobProgressToken": "0001491865740912-242b71effffxxxx-0001" }
jobProgressToken
- the token to track the job status.
Use the GET
method to get the status of the scheduled job. The type of the job progress token: bulk_executions_archive_job_progress
.
Get archived executions
Get the archived executions by using the query shown below.
Request
GET http(s)://<SERVER>/rest/zapi/latest/execution/archive?projectId=&versionId=&cycleId=&folderId=&offset=&maxRecords=
Query parameters:
projectId
- the IDs of the project. Provide IDs separated by comma (,)
versionId
- the IDs of the version. Provide IDs separated by comma (,)
cycleId
- the IDs of the cycle. Provide IDs separated by comma (,)
folderId
- the IDs of the folder. Provide IDs separated by comma (,)
offset
- offset of Execution (Integer)
maxRecords
- Max archived executions to be fetched (Integer)
Response
Response body
{ "executions": [ { "id": 409, "orderId": 1, "cycleId": -1, "cycleName": "Ad hoc", "issueId": "10125", "issueKey": "IE-1", "issueSummary": "cx", "labels": [], "issueDescription": "", "projectKey": "IE", "projectId": 10201, "project": "IE", "projectAvatarId": 10224, "priority": "Major", "components": [], "versionId": -1, "versionName": "Unscheduled", "status": { "id": -1, "name": "UNEXECUTED", "description": "The test has not been executed yet.", "color": "#A0A0A0", "type": 0 }, "executedOn": "", "creationDate": "27/Apr/16", "comment": "", "htmlComment": "", "executedBy": "", "executedByUserName": "", "executionDefects": [], "stepDefects": [], "executionDefectCount": 0, "stepDefectCount": 0, "totalDefectCount": 0, "executedByDisplay": "", "assignee": "", "assigneeUserName": "", "assigneeDisplay": "", "archivedBy": "", "archivedByUserName": "", "archivedByDisplay", "", "archivedOn": "" } ], "currentIndex": 1, "maxResultAllowed": 20, "linksNew": [ 1 ], "totalCount": 1, "executionIds": [] }
Export archived executions
Use this API to export and download archived executions via URL returned in the response body.
Request
POST http(s)://<SERVER>/rest/zapi/latest/execution/archive/export
Request body:
{ "exportType": "xls", "maxAllowedResult": "true", "expand": "teststeps", "startIndex": "0", "isUI": false }
exportType
- the export types are “xls”, “csv”, “html”, “xml”.
Response
Response body
{ "url": "http://localhost:8091/plugins/servlet/export/exportAttachment?fileName=ZFJ-Arch-Executions.xls" }