Closed st3vo7 closed 2 years ago
The goal of Fermata and its plugins is to provide direct access to the underlying HTTP API. I don't know if this is the official documentation (perhaps Chargify got acquired?) but at https://docs.cloud-elements.com/home/chargify-api-documentation you can browse the available options for GET /subscriptions
. One of them is is pageSize
:
The number of resources to return in a given page
which I'm guessing might default to 20 if you don't provide it?
You could try to fetch a few extra site.subscriptions({pageSize:25}).get(callback_fun)
and if that does change the results then you'll either want to increase the page size to a huge number (if their API allows you to do so) or you'll probably want to add handling to your code for their elements-next-page-token
response header and make multiple requests like ({pageSize:250, nextPage: tokenFromPrevResponse})
until you've processed all the available objects.
Hope this helps!
Indeed, I made use of per_page
and page
parameters, as {per_page: 200, page: i}
. For more info on those, I can refer others to read List Subscriptions part of the chargify documentation.
However, there were some issues to overcome in looping through all the pages in combination with the callback syntax. I reckon, it would be much easier if the library would use async/await syntax.
Thanks for thorough reply.
Thanks, agree that async support would be useful! No real blocker at this point iirc, just haven't circled back to working out an overall "Fermata v2" yet. (For reference, looks like my latest notes on this specifically were at https://github.com/natevw/fermata/issues/49#issuecomment-358812649.)
site.subscriptions.get(callback_fun)
doesn't fetch all subscriptions. Out of several thousand, I end up fetching only first 20. Why is this happening and how to overcome it?