How to get a list of test cases belonging to a folder including subfolders with APIs
Hello,
I am looking for a way to get a list of test cases belonging to a folder including also subfolders using API calls. If I use /testcase/search I can provide folder field into query key but in this way I only get the test cases that belong to the folder and not to subfolders.
Is there a way to do it?
Hi, RobertoM
Since you're using the Confluence plugin, you're likely to be using the Server/DC version of the app. In this case, you can use the private API to achieve this.
The endpoint is https://{{your-jira-url}}/rest/tests/1.0/testcase/search?archived=false&fields=id,key,projectId,name&maxResults=40&query=testCase.projectId+IN+({{your-project-id}})+AND+testCase.folderTreeId+IN+({{your-folder-id}})&startAt=0
Use your Jira username and your password to authenticate, using Basic Auth authorization.
You can get the project ID via the Jira REST API.
Please keep in mind that this is not officially supported and therefore this endpoint might change in the future without any previous notice.
It would be nice if you could raise this in the Ideas Portal even though this workaround works for you, so the team can gather interest around this feature and provide official ways to do it.
Cheers!