#Mota
1 messages · Page 1 of 1 (latest)
hi! can you elaborate on what exactly you're doing and the use case in more detail?
yeah, sure
I'm trying to display a table with the new subscriptions in the last 30 days and the subscriptions that are in the past_due status. I'm using pagination to get the results faster, and set the limit to 20, to reduce the time even further, but it still takes about 10 seconds to get all the results
oh, and for each subscription I still need some details, such as the subscription plan and the customer email and name
what API are you using to do that?
but overall if you want a faster approach consider listening to webhooks and populating a local database over time, and then you can query that quickly
you 100% do not want to be calling our API to get all this information every time a page is loaded in your webapp
I'm using the events.list method of the events api
the problem is if I start using the webhooks now, I won't be able to show the subscriptions that were already created
you won't be able to do that anyway since the Events API only returns events created within the last 30 days
but I only need for the last 30 days
fair enough!
but yeah not sure what else I can say. Rebuilding the state of everything using the Event API is going to be slow. You can build a database over time by listening to webhooks. You can use the List Subscriptions API to get the current count and state of subscriptions.
ok, thanks anyway, I'll try the list subscriptions