API - Tips and Tricks
  • 1 Minute to read
  • Dark
    Light
  • PDF

API - Tips and Tricks

  • Dark
    Light
  • PDF

Article Summary

Prerequisites

You have already setup Postman and imported the Panaya Catalog of API examples and Panaya Shared Environment 

Pagination

Some of the API calls like get all Defects and get all Requirements are limited to 25 records per API call.  This can be increased to 100 records per call using a pageSize, and then one could navigate through the records by changing the pageNumber.  For example:

api/v1/projects/{{projectId}}/defects?pageNumber=1&pageSize=100
api/v1/projects/{{projectId}}/requirements?pageNumbe=1&pageSize=100

If we wanted to limit the pageSize to 10 records and access the first 10 records of requirements, it would look like this: 

Search By Date

If we wanted to search by specific dates, we would need to append a query that uses a datetimesRange to our API call, and it would need to be in the following format:

{{url}}/api/v1/projects/{{projectId}}/requirements?query="Last Modified Date"=datetimesRange,2021-06-09T00:00:01z,2022-06-09T23:59:59z&order="Last Modified Date"-

So for example, if wanted to search for requirements that were last modified between Jan 10 2022 and March 10 2020, it would look something like this:

Search by field values

If we wanted to search for a specific field value and only return that specific field, we would include the fields parameter along with a query of what the field value should be:

{{url}}/api/v1/projects/{{projectId}}/tasks?fields="Status"&query="Status"="Testing"

So for example, if wanted to search for tasks whose Status is equal to Testing, and we don't need additional fields but just a list of Task IDs and the Status, it would look something like this:

If we wanted to search for defects where a specific field, in this case "Contains personal information" = yes, it would look like this:

{{url}}/api/v1/projects/{{projectId}}/defects/?query="Contains personal information"="Yes" 

If we wanted to search for defects with a specific value in one of the fields and specify which other fields should be included, it would look like this:

{{url}}/api/v1/projects/{{projectId}}/defects/?query="Contains personal information"="Yes"&fields="Resolved Reason","Cycle Name"

If we wanted to search for defects and use pagination, as well as set 3 different filters to limit the result set, it would look like this:

{{url}}/api/v1/projects/{{projectId}}/defects?&pageNumber=1&pageSize=100&query="Status"="Open";"Priority"="High";"Blocking next step"="true"