PractiTest Discussion Forum

Fetching All The Cases from a filter using APIs

Hi Everyone, Our Test Project has a test filter(Image attached). This test filter contain the tests which have certain fields. I want a way in which I can GET the cases present in the filter using APIs. If fetching from a filter is not possible then can I know a way in which I can fetch only the responses which contain a paticular a tag or a paticular custom field from the entire library?
Thanks!

This one actually easier than your previous question, you just add a parameter
?filter-id=12345 to your GET tests request. Only way to get the filter ID though is in the URL in the Ui - just go to Test library, click on the filter and you’ll see the number in the URL: cv=12345

Thanks!
Also, Can we create a Filter using APIs?

Sure :slight_smile: And no, I don’t think such an option exists, at least I never saw it. You can create an auto filter. Manually, from UI, but it will automatically create a filter for each value of the selected list field.
Why do you need your automation to create filters, if I may ask?

We create a filter for every release of our Software version which contains all the cases associated to that version, which help us track the cases. So My Idea would be:

  1. To create a filter name it say 2.28.0
  2. I Create a test Set in this filter(Already Available with APIs)
  3. Add The Automated TestCases(I can follow the steps you said above)

Currently we do Step 2 and Step 3 in our Automation Framework, but the prerequisite is to have a filter with 2.28.0. If we could create a filter using APIs, we could get more end to end automated Solution.