Hi,
I’m in the middle of revamping our API code and I noticed that the ‘page’ parameter is no longer in the Groups endpoint. Am looking at it wrong? https://docs.discourse.org/#tag/Groups
Regards,
Mark Pemburn
Blue Ocean Ideas
A discussion about pagination for the Groups endpoint in Discourse API is ongoing. mpemburn initially reported that the ‘page’ parameter was missing, but blake clarified that it still exists and is functional, albeit not documented. mpemburn inquired about the number of results per page and how to determine the last page, to which blake replied that an empty array is returned when there are no more results. mpemburn also mentioned that ‘limit’ and ‘offset’ parameters do not work, despite being suggested in an older post. blake confirmed that these parameters are not available and the default page size is 36. Additionally, rossinboulder pointed out that the Discourse Ruby API Gem does not support pagination, limiting the retrieval of groups to the first 36 records.
Hi,
I’m in the middle of revamping our API code and I noticed that the ‘page’ parameter is no longer in the Groups endpoint. Am looking at it wrong? https://docs.discourse.org/#tag/Groups
Regards,
Mark Pemburn
Blue Ocean Ideas
It’s still there. It probably just isn’t documented yet.
https://meta.discourse.org/groups.json?page=1
Thanks! Is there a way to know how many per page? Or what is returned when you’ve reached the last page?
See here:
https://meta.discourse.org/groups.json?page=2
Looks like it will return an empty array if there are no more results.
{"groups":[],"extras":{"type_filters":["my","owner","public","close","automatic"]},"total_rows_groups":60,"load_more_groups":"/groups?page=3"}
Thanks!
I found this post from a while ago that suggests that there are parameters for limit and offset. I tried them, and they do nothing.
https://meta.discourse.org/t/groups-api-now-requires-pagination-in-latest-release/120982
Mark
P.S. We’re on version 2.6.0.beta1 which I gather is the latest.
Looks like there are no limit or offset parameters on the groups endpoint. The default page size is 36 though.
Just curious how many groups do you have?
The Discourse Ruby API Gem does not accept a “page:” parameter, so there’s no way to retrieve more than the first 36 records. From github:
def groups response = get("/groups.json") response.body end
The repository does not appear to allow me to create new issues, so I’m not sure how we go about getting this fixed?