Reputation: 21426
I use GitHub api, that described here: GET /repos/:owner/:repo/tags
The command looks like:
curl https://api.github.com/repos/skywinder/ActionSheetPicker-3.0/tags
But this command get only last 30 tags.
Is it possible to receive all tags from GitHub repo?
Upvotes: 2
Views: 1854
Reputation: 2194
Definitely pagination as the first answer indicates. The default pagination is 30 per page. You can tweak this to return up to 100 per page, by passing in the per_page
parameter.
Although there is no API command to return all records at once, I would recommend looking at how the GitHub ruby client implements its auto_paginate
feature and/or the oktokit.js paginate method and/or the API documentation regarding a custom js pagination implementation.
I'll use the ruby client implementation as an example. It defaults to the standard pagination, but this can be overridden by calling client.auto_paginate = true
When auto_paginate
is true and pagination is applied to a given endpoint, the client will:
per_page
to the max of 100rel['next']
, it means there's another page to fetch.Note, you can check your rate limit status by calling the https://api.github.com/rate_limit
endpoint and checking rate.remaining
. If you hit the limit, you will get an error and need to wait until the rate.reset
time.
Upvotes: 0
Reputation: 18782
I'm guessing you're getting trolled by pagination:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api#pagination
API responses contain links to fetch other pages of the list.
Upvotes: 4