Working with paginated responses in the Ping Proxies API
The Ping Proxies API uses pagination to manage large result sets efficiently. Without pagination, endpoints that return many items could slow down your application and consume unnecessary bandwidth.
When you make a request to an endpoint that returns multiple items (like search endpoints), the API divides the results into pages and returns one page at a time. This approach:
Improves performance for large datasets
Reduces bandwidth consumption
Provides more predictable response times
Makes responses easier to process
Some /search endpoints may return total_count as -1 in cases where the number of objects is too large to count efficiently and quickly.
Paginated responses include metadata to help you navigate through all available results. Here’s what you’ll find in a typical paginated response:
Copy
{ "data": [ // Array of items for the current page ], "item_count": 25, // Number of items in the current page "message": "Search successful", "page": 2, // Current page number "per_page": 25, // Items per page "total_count": 134 // Total items across all pages}
For faster data collection, you can calculate the total pages and make multiple concurrent requests. This approach is particularly useful when you need to retrieve a large dataset quickly.The parallel examples above show how to implement this pattern in different languages.
Use parallel paging cautiously to avoid rate limiting. Consider how many concurrent requests you’re making to the API.