ggonmar
ggonmar

Reputation: 839

XRay Cloud GraphQL API to return more than 100 results

I'm trying to make use of GraphQL API for Jira XRay Cloud (documentation here ) with the objective of solving the limitation of max 100 results established.

More specifically, I would like to be able to somehow retrieve all tests contained on a Test Plan, for which I'm using:

            getTestPlan(issueId:"${test_plan.id}"){
              issueId
              tests(limit: 100) {
                  results {
                      issueId
                      jira(fields: ["key"])
                  }
                }
              }
            }

However, if the Test Plan contains 130 tests, I am unable to get the remaining 30. How would I ask graphQL to provide me with "the following 100 results" ?

I've attempted to set the request as tests(limit:100, after: 100), as well as including a pageInfo with hasNextPage, but to no avail - I guess it must be some definition on the specific graphQL endpoint, but I'm an absolute rookie on graphQL so I can't really tell.

Thanks for the help!

Upvotes: 1

Views: 1107

Answers (1)

Cristiano Cunha
Cristiano Cunha

Reputation: 391

on the response of the first request you will have the following information available:

  • total, with the total number of entries available
  • start, the start of the next page of results
  • limit, the limit used in the request

So based on that information you should do the first request exactly as you have and the next one adding the "start" to it like below:

getTestPlan(issueId:"${test_plan.id}"){
          issueId
          tests(limit: 100 start:100) {
              results {
                  issueId
                  jira(fields: ["key"])
              }
            }
          }
        }

Upvotes: 3

Related Questions