View
 

Paging

Page history last edited by Jim Fleming 7 mos ago

A lot of the REST API calls support paging.  This ensure that you can deal with large result sets in a reasonable manner.  To understand how paging works you need to understand the query string parameters that need to be provided as well and the JSON response properties related to paging.

 

Supported URL Parameters:

When making a call to a REST endpoint that supports paging you can provide the following parameters:

 

Name Description
p The page you are requesting.  If not specified it will default to 1.
ps The page size (number of items per page) you are requesting.  If not specified it will default to 10.

 

Example

If you wanted to make a request for page 5 with a page size of 50 to the "/requests" endpoint then your URL would look as follows:

 

     /requests?p=5&ps=50

 

JSON Response Properties:

When making a call to a REST endpoint that supports paging the JSON object that is returned will contain the following properties related to paging:

 

Name Description
p The page that is being returned
ps The page size (number of items per page).
np The total number of pages for the endpoint requested.
nr The total number of results across all pages.
r The collection of results.

 

Example

The following is an example response from a call to the "/requests" endpoint that shows the JSON response properties related to paging:

 

{

     "p":2,

     "ps":10,

     "np":2,

     "nr":15,

     "r":

          [

               {

                    "uri":"/ws/requests/2009/7/28",

                    "qs":"access_key=12345&p=2",

                    "dc":"2009-07-28T17:35:26Z",

                    "ak":"12345"

               },{

                    "uri":"/ws/requests/2009/7/28",

                    "qs":"access_key=12345&p=2",

                    "dc":"2009-07-28T17:35:27Z",

                    "ak":"12345"

               },{

                    "uri":"/ws/requests/2009/7/28",

                    "qs":"access_key=12345&p=2",

                    "dc":"2009-07-28T17:35:35Z",

                    "ak":"12345"

               },{

                    "uri":"/ws/requests/2009/7/28",

                    "qs":"access_key=12345&p=2",

                    "dc":"2009-07-28T17:35:44Z",

                    "ak":"12345"

               },{

                    "uri":"/ws/requests/2009/7/28",

                    "qs":"access_key=12345&p=2",

                    "dc":"2009-07-28T17:35:51Z",

                    "ak":"12345"

               }

          ]

} 

Comments (0)

You don't have permission to comment on this page.