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 ST 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.
Note
Please be sure to only include filters; other options will not be accepted and may cause errors. For more details on other option parameters see this section.
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
GET /clientapis/v1.0/setCache?ST={{securityToken}}&RequestIdentifier=dateRangeCall&PageRows=50&ModifiedStart=2020-07-01%2000:00:00&ModifiedEnd=2020-07-02%2000:00:00
RESPONSE
"data": [
{
"PageRows": "50",
"RecordCount": "67",
"RecordPages": "2"
}
]
}
Step 2: Get Paged Data
Now you would update the rdDataID 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
GET /clientapis/v1.0/getRecordFields?ST={{securityToken}}&UseCache=true&RequestIdentifier=dateRangeCall&PageRows=50&ModifiedStart=2020-07-01%2000:00:00&ModifiedEnd=2020-07-02%2000:00:00&rdDataID=getRecordFields&Page=1
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"
}
]
}