GraphQL pagination response, probably displays wrong results in V4 #24566
-
I think the response I got from my paginated query might be wrong.
And those are my input variables
And finally this is the response I got:
Now as you can see this repo has about 12k stars and I got hasNextPage false. Am I missing something? Is my query wrong? I want to get all the repositories with stars count bigger than 500 and ordered by starts count from big to small. Any idea? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi Matteo, Both the REST API and GraphQL API cap the number of returned results at 1000 and the after argument in your query is pointing to the very last result that can be returned (as the API currently uses base64 to encode these values, we can confirm that “Y3Vyc29yOjEwMDA=” is " cursor:999"). Because there’s no more results we can return, hasNextPage: false is expected here. If you wanted to work around the 1000 result limit, I’d suggest trying to further narrow your search. You can use ranges (such as stars:500…600) but as this is searching all repositories on GitHub, you might find you need to filter those results further. Here’s an example that also filters by language:
Note that I’ve included repositoryCount too which allows us to confirm the total number of results we’re working with. I hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi Matteo,
Both the REST API and GraphQL API cap the number of returned results at 1000 and the after argument in your query is pointing to the very last result that can be returned (as the API currently uses base64 to encode these values, we can confirm that “Y3Vyc29yOjEwMDA=” is " cursor:999"). Because there’s no more results we can return, hasNextPage: false is expected here.
If you wanted to work around the 1000 result limit, I’d suggest trying to further narrow your search. You can use ranges (such as stars:500…600) but as this is searching all repositories on GitHub, you might find you need to filter those results further. Here’s an example that also filters by language: