Body Paging
Body paging is used when the page parameter is to be included in the request body.
A response is considered to be complete if the last page if it is empty.
Response paging is available for JSON and XML requests.
Body Paging has four properties to control its operation. This allows you to integrate with services which have implemented Body Paging differently.
- Paging Start At
- Specifies the number at which paging starts at. Typically this is 1, to denote the first page or record.
- Paging Path/Parameter Name
- This is the either the XPath or JPath to the page number node/property. Full explanations for path syntax can be found here and here for Xml & JSON formats respectively.
- Paging Increment By
- This property specifies how much the paging node/property will be incremented by on each requested page.
- Paging Increment/Parameter Name
- When this property has a value, this allows you to also specify a page size (or to specify a number of records to return) in the URL sent to the service. The value of the node/property is the 'Paging Increment By'. Full explanations for path syntax can be found here and here for Xml & JSON formats respectively.
Specify ONLY Page Parameter (Default Page Size)
Setting a page parameter tells the web-service which page of data to return. Often these can be combined with setting a page size parameter. Some services have a predefined or default page size.
For example, with a default page size of 50, page one would return the first 50 records, page two would return records 51-100.
Example Body
First Request
JSON: { "page" : 1, "filter" : "order_status eq open" }
XML: <orders><page>1</page><filter>order_status eq open</filter></orders>
Second Request
JSON: { "page" : 2, "filter" : "order_status eq open" }
XML: <orders><page>2</page><filter>order_status eq open</filter></orders>
Specify Page and Page Size
When specifying a page parameter, you can also set the page size or offset, where the offset in this case is the start parameter. This mode is used when the service requires you to specify a record number offset, as opposed to a page (and accompanying page size).
For example, setting a page size of 100, page one would return the first 100 records. Page two would return records 101-200.
Example Body
First Request
First request: JSON: { "start" : 1, "size" : 100, "filter" : "order_status eq open" }
XML: <orders><start>1</start><size>100</size><filter>order_status eq open</filter></orders>
Second Request JSON: { "start" : 101, "size" : 100, "filter" : "order_status eq open" }
XML: <orders><start>101</start><size>100</size><filter>order_status eq open</filter></orders>