You can use Zephyr Enterprise REST API to search for test cases, requirements, and executions (??????) programmatically.
Request URL
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Panel | ||||||
| ||||||
Starting October 11, 2024 (Zephyr Enterprise 8.2), the Zephyr Enterprise documentation moved from its current location on Atlassian to a dedicated, standalone Zephyr Enterprise documentation page. Please see: https://support.smartbear.com/zephyr-enterprise/docs/en/zephyr-enterprise/zephyr-rest-api/search-api.html |
You can use Zephyr Enterprise REST API to search for test cases, requirements, and executions programmatically.
Request URL
Code Block | ||
---|---|---|
| ||
GET http(s)://{ZEPHYR-SERVER}/flex/services/rest/latest/advancesearch? word=<text> &entitytype=<entitytype> &releaseid=<id> &zql=false &isascorder=true &order=<fieldname> &firstresult=0 &maxresults=100 &is_cfield=false &isOld=false |
Authentication
You can authenticate your requests by using one of the methods described in the Zephyr REST API topic.
Request parameters
project="Portfolio" and executionStatus=PASS
Value | Type | Description |
---|---|---|
word (required) | string | A string to search for. You can specify some text or a ZQL query (in the latter case, you will have to specify |
test
| ||
entitytype (required) | string | The type of the entity to search for. |
Possible values:
| ||
releaseid (required) | long | The ID of the release the entity belongs to. To see the release ID in Zephyr, click Manage Release in the top-right corner and take a look at the value of the ID column in the subsequent window: |
zql (required) | boolean | Specifies whether ZQL is used. |
isascorder (optional)
boolean
Switches the ascending order.
|
isascorder (optional) |
string
The column order. For example, the parameter value can be orderId: .../flex/services/rest/v3/advancesearch/?word=test&firstresult=0&maxresults=50&order=orderId&releaseid=1
firstresult (required)
integer
The starting point of the record.
maxresults (required)
integer
The number of records to be fetched.
is_cfield (optional)
boolean
Custom field order.
isOld (optional)
boolean
Specifies whether the test case is old.
Authentication
You can authenticate your requests by using one of the methods described in the Zephyr REST API topic.
Pagination
...
boolean | Switches the ascending order. Specify | |
order (optional) | string | The field to sort data by (this can be either a standard or a custom field). For example: |
firstresult (required) | integer | The first element of the retrieved results. The parameter is zero-based, which means you need to specify |
...
GET /flex/services/rest/latest/advancesearch?word=test&entitytype=testcase&releaseid=1&zql=false&firstresult=0&maxresults=10
Sample response
...
language | json |
---|
...
maxresults (required) | integer | The number of records to be fetched. The maximum number is 100. |
is_cfield (optional) | boolean | If the |
Pagination
You can specify the first element of the retrieved results and the number of items to show by using the firstresult
and maxresults
query parameters respectively. The firstresult
parameter is zero-based, which means you need to specify 0
as the start position to begin with the first element. The sample request below will show a list of results starting from the first element, and the maximum number of retrieved items will be 100:
GET /flex/services/rest/latest/advancesearch?word=test&entitytype=testcase&releaseid=1&zql=false&firstresult=0&maxresults=100
Sample requests
ZQL is not used:
GET /flex/services/rest/latest/advancesearch?word=test&entitytype=testcase&releaseid=1&zql=false&firstresult=0&maxresults=100
ZQL is used:
GET /flex/services/rest/latest/advancesearch?word=creator="test.manager" and priority="P1"&entitytype=testcase&releaseid=1&zql=true&firstresult=0&maxresults=100
Sample response
On success, the operation returns status code 200 and a JSON object containing metadata and found results. The structure of these results varies depending on the sought-for entities, items and so on. Below is a sample response obtained when searching for an execution:
Code Block | ||
---|---|---|
| ||
[ { "firstResult": 0, "resultSize": 1, "results": [ { "id": 147, ----------------------------------- The TCRRTS CatalogID Tree(the TestCaseexecution ID (tctid) "tcrCatalogTreeIdassignmentDate":30, "2020-09-15", "revisionactualTime":9 600, "versionId": "stateFlag1":0, "lastModifiedOncomment":1600168120466, "This is a comment", "versionNumbertesterId":1 5, "createDatetimeexecutedBy":1600168114777 5, "createdById"tcrTreeTestcase":5, { "modifiedByIdid":5 308, ----------------------------------- The TCR Catalog Tree TestCase ID (tctid) "testcasetcrCatalogTreeId":{ 30, "customPropertiesrevision":{ 9, }, "stateFlag": 0, "customProcessedPropertieslastModifiedOn":{ 1600168120466, }, "versionNumber": 1, "idcreateDatetime":165, ----------------------------------- The test case version ID 1600168114777, "createdById": 5, "name":"edited 159 testcase edit", "modifiedById": 5, "descriptiontestcase":"", { "lastModifiedOncustomProperties":1600169396082, { "creationDate":1600128000000}, "createDatetimecustomProcessedProperties":1600168102437, { "tcCreationDate":"09/15/2020"}, "commentsid":"", 165, ----------------------------------- The test case version ID "isComplexname":false, "edited 159 testcase edit", "estimatedTimedescription":600 "", "writerIdlastModifiedOn":0 1600169396082, "creatorIdcreationDate":5 1600128000000, "lastUpdaterIdcreateDatetime":5 1600168102437, "oldIdtcCreationDate":0 "09/15/2020", "automatedcomments":false "", "customFieldProcessedisComplex": false, "customFieldValuesestimatedTime":[ 600, "writerId": 0, ]"creatorId": 5, "testcaseSequencelastUpdaterId":{ 5, "oldId": 0, "seqNumber "automated":159 false, "customFieldProcessed": }false, "testcaseIdcustomFieldValues":159, ----------------------------------- The test case ID [ "versionNumber":1, "projectId":3], "testcaseTypetestcaseSequence":"ORIGINAL", { "requirementIdsseqNumber":[ 159 }, ], "testcaseId": 159, ----------------------------------- The test case ID "projectNameversionNumber":"P1" 1, "requirementIdsNewprojectId":[ 3, "testcaseType": "ORIGINAL", ],"requirementIds": [ "creatorName":"divya divya", "lastModifierName":"divya divya" ], "automatedDefaultprojectName":false, "P1", "testcaseSharedrequirementIdsNew":false [ }, "projectId":3, ], "releaseId":5, "creatorName": "John Smith"isDerivedFromBDD":false,, "orderIdlastModifierName":453, "John Smith", "maxVersionNumberautomatedDefault":1 false, "projectIdParamtestcaseShared":3, false }, "original":false "projectId": }3, "cyclePhaseIdreleaseId":7 5, "lastTestResultisDerivedFromBDD":{ false, "idorderId":58 453, "executionDatemaxVersionNumber":1600169404251 1, "execDateprojectIdParam":"09/15/2020" 3, "executionStatusoriginal":"4", false "testerId":5, }, "releaseTestScheduleIdcyclePhaseId":147 7, "createDatetimelastTestResult":1600169404253, { "modifiedDatetimeid":1600169404250 58, "createdByIdexecutionDate":5 1600169404251, "modifiedByIdexecDate":5 "09/15/2020", }, "executionStatus": "4", "defects":[ "testerId": 5, "releaseTestScheduleId": ]147, "attachmentCountcreateDatetime":0 1600169404253, "lastModifiedBymodifiedDatetime":5 1600169404250, "createdById": 5, "lastModifiedOnmodifiedById":1600169404255 5 }, "createDatetimedefects":1600168120467 [ } ], "typeattachmentCount":"testSchedule" 0, } ] |
Response codes
...
HTTP Status Code
...
Description
...
200
...
The request completed successfully.
...
400
...
Bad request. At least one releaseid
or departmentid
parameter is required.
...
401
...
The authentication token is missing.
...
403
...
The user has no permissions to perform this operation.
...
500
...
"lastModifiedBy": 5,
"createdById": 5,
"lastModifiedOn": 1600169404255,
"createDatetime": 1600168120467
}
],
"type": "testSchedule"
}
] |
If no items matching the specified criteria are found, an empty results array is returned:
Code Block |
---|
[
{
"firstResult": 0,
"resultSize": 0,
"results": [],
"type": "testcase"
}
] |
Response Codes
HTTP Status Code | Description |
---|---|
200 | The request completed successfully. |
400 | Bad request. |
401 | The authentication token is missing. |
403 | The user has no permissions to perform this operation. |
500 | Unknown internal error. |
Anchor | ||||
---|---|---|---|---|
|
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|