Skip to content

How do I get the next page of results from my request?

Results of large GET requests may be "paginated" in order to better handle server resources and the flow of data.  Most API responses will contain the response variables:

response-> result_count = <integer>
response->current_page = <integer>
response->total_pages = <integer>
response->max_results_per_page = <integer>

The result_count variable will be an integer value that provides the total number of line items that fit your response criteria.
The total_pages variable will tell you how many pages your resulting data has been divided into.
The current_page variable will tell you the current page you were just provided with in the current response.
The max_results_per_page variable will tell you how many results are included on each API response.

You should check for the total_pages and current_page fields to verify that the current response contains all your data.  If paginated, by default, the response will include just Page 1 of your response data and the total_pages variable will be a larger integer.  If you want to receive a different page from your response data, simply include a parameter called "page" with an integer value that corresponds to the page number you wish to receive.  Page numbers begin with page 1.  There is no page 0.  Here's an example that uses our sample "executeCommand" PHP function to perform a query that retrieves the 3rd page of data:


     $parameters = new stdClass();
     $parameters->start_date = date("Y-m-d",strtotime("today -3 months"));
     $parameters->end_date = date("Y-m-d",strtotime("today"));
     $parameters->page = 3;

     $jsonResult = executeCommand("/schedule","GET","<<insert access_token>>",$parameters);



Feedback and Knowledge Base