The problem is that this only returns 100 subscribers at a time, but I have around 600 people subscribed to my list. I need to fetch all of them to run some processing logic on the complete dataset.
I’ve been looking through the API docs but can’t figure out how to bypass this 100 item restriction. Is there a parameter I can add to get more results per request? Or do I need to make multiple calls somehow?
Any help would be appreciated since I’m pretty stuck on this one.
The 100 record limit is inherent to Mailgun’s API, and there’s no single parameter to bypass it. I encountered the same limitation during a recent migration of my email lists. You’ll need to implement pagination by sending multiple requests utilizing the ‘skip’ parameter. Begin retrieving records from 0-99, then set skip=100 for records 100-199, and continue this process. When you receive fewer than 100 records in response, you’ve successfully collected all 600 subscribers.
You can utilize the limit parameter to define the number of records you wish to retrieve, although it’s capped at 100. I recommend implementing a loop that continues making requests until you have retrieved all the necessary data. Pay attention to the total count provided in the response headers and terminate the loop when you receive fewer records than requested. Given that you have 600 subscribers, this would generally require making 6 calls due to the pagination restrictions.
mailgun limits you to 100 records each time. what i did was use a while loop with skip, just keep adding 100 until you get less than 100 back or an empty response. took me about 6 calls for my list of over 500, but it did the trick!