Paging allows you to extract records in a series of individual “pages” requests. The pages can be sequentially called until all records are returned. Paging uses the Cache mechanism to efficiently collect all records that match the given filter.
The process has two steps:
- Call the setCache API with all needed parameters. This will return a count of the number of records and/or field pages needed to collect all records.
- Sequentially calls pages for the desired API from 1 to the page count
Note
It is important to setCache especially in cases where data has the potential to change from your first call to your next call. This will ensure the dataset cached does not change if new docs are added. Please ensure no other calls are made to any APIs using the same Username prior to acquiring all the data or the cache may be overwritten with new data and the data will not be accurate. If there is a need to isolate the data during this process to ensure this does not happen, a query variable called RequestIdentifier can be used; see EXAMPLE below.
EXAMPLE
In this example we will use getRecordFields and use paging to get all records retrieved related to the query across multiple pages.
STEP 1: Call SetCache
Start by adding all your filter parameters associated with the data you are trying to receive, this can include date ranges, resource name, location, form name, etc.
REQUEST
POST /clientAPIs/2.0/SetCache
{
"RequestIdentifier": "dateRangeCall",
"Filters": {
"DateFilters": {
"DateType": "Modified",
"TimeZoneOffset": 0,
"End": "2024-02-01",
"Start": "2024-01-01"
},
"Paging": {
"PageRows": 50
},
"OrderBy": {
"Custom": "Modified",
"ASC": true
},
}
}
RESPONSE
"data": [
{
"PageRows": "50",
"RecordCount": "67",
"RecordPages": "2"
}
]
}
Step 2: Get Paged Data
Now you would update the call to /getRecordFields and including the Page starting at "1"; maintaining all the filter and modification parameters from the previous request. Repeat this process incrementing the Page up until RecordPages value.
Important:
When getting paged data ensure you have the query parameter UseCache=true and the same RequestIdentifier as your previous request. If not included this may have impact on your response data.
REQUEST
POST /clientapis/2.0/GetRecordsWithFields
{
"RequestIdentifier": "dateRangeCall",
"UseCache": true,
"Filters": {
"DateFilters": {
"DateType": "Modified",
"TimeZoneOffset": 0,
"End": "2024-02-01",
"Start": "2024-01-01"
},
"Paging": {
"Page": 1,
"PageRows": 50
},
"OrderBy": {
"Custom": "Modified",
"ASC": true
},
}
}
RESPONSE
{
"data": [
{
"RecordNumber": "string",
"SubmittedDate": "string",
"FieldName": "string",
"FieldShortName": "string",
"FieldType": "string",
"FieldValue": "string",
"Row": "1"
},
...
{
"RecordNumber": "string",
"SubmittedDate": "string",
"FieldName": "string",
"FieldShortName": "string",
"FieldType": "string",
"FieldValue": "string",
"Row": "50"
}
]
}