Page Size and Pagination

Page Size

Page size enables you to specify the max number of rows to be returned in response and this can be any value between 1 to 50000. Invalid values or values out of the specified range are discarded and the default value of 50000 is used.

For example: In below JSON input, it limits the response to have only 100 records even though there are more than 100 records in W_PAYMENT_D table

JSON Input

{

"name": "PAYMENT",

"pageSize": "100",

"tables": [

{

"tableName": "W_PAYMENT_D",

"columns": [

"PAYMENT_OBJECT_ID",

"PROJECT_OBJECT_ID",

"CONTRACT_OBJECT_ID"

]

}

]

}

Pagination

Pagination enables you to organize the content of large responses into smaller, more manageable chunks. The response contains pagination information to indicate that there are more pages of data that have not been returned. You can send the same request again along with the pagination information to get the rest of the data.

For example, the following response contains pagination information:

       "pagination": [

            {

                "nextTableName": "W_PAYMENT_D",

                "nextKey": "101"

            }

        ]

To retrieve the next page of the data, set the "nextTableName" and "nextKey" properties in the original JSON request and run the query again using the /longrunquery endpoint. The response will again return a unique key, which should be used in a subsequent call to the result/<key> end point and it fetches number of rows specified in "pageSize" property (or the max page size which is 50,000). If there is more data, the response will include a new section of pagination information. You can continue to send requests with new pagination information until the "pagination" section in the response JSON text shows "nextTableName" as "-1".

Sample Response with Pagination Data

{

"data": {

"W_PAYMENT_D": [

{

"PAYMENT_OBJECT_ID": "999683",

"PROJECT_OBJECT_ID": "13428",

"CONTRACT_OBJECT_ID": "658370"

},

.

.

.

.

{

"PAYMENT_OBJECT_ID": "1146540",

"PROJECT_OBJECT_ID": "15248",

"CONTRACT_OBJECT_ID": "840741"

}

],

"pagination": [

{

"nextTableName": "W_PAYMENT_D",

"nextKey": "101"

}

],

"safetyDate": [

{

"queryName": "PAYMENT",

"sinceDate": null

}

]

}

}

Sample Request for Next Page

{

"name": "PAYMENT",

"nextTableName": "W_PAYMENT_D",

"nextKey": "101",

"pageSize": "100",

"tables": [

{

"tableName": "W_PAYMENT_D",

"columns": [

"PAYMENT_OBJECT_ID",

"PROJECT_OBJECT_ID",

"CONTRACT_OBJECT_ID"

]

}

]

}



Last Published Tuesday, February 6, 2024