Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

REST Connector Pagination

HenryMK
New Contributor III
New Contributor III

Rest API Response retuen Value

 

 

 

{
    "data": {
        "employeesTotal": 1189,
        "hasMore": true,
        ...
    }
}

 

 

 

In the following cases, we ask if there is a way to process the page.
offset : call start index
limit : number of calls at a time

 

Case1. Offset Pagination - Start Batch with 1
URL being called : <URL>?offset=0&limite=50 > Error
I want the offset value to be called with 1 not 0
<URL>?offset=1&limite=50 

 

 

 

"pagination": {
  "offset": {
    "offsetParam": "offset",
    "batchParam": "limit",
    "batchSize": 50,
    "totalCountPath": "completeResponseMap.totalResults"
  }
}

 

 

 

 

Case2. There is no start index or offset value in the response
I wonder if it is possible to handle it by setting the variable value.
Is it possible to continuously add 50 to the tempoffset value?
The below is not correct, but it is the form you want to process.

"pagination": {
"nextUrl": {
"nextUrlPath": "${
var tempoffset = 1;
response?.data?.hasMore==true?'<URL>?offset='+Math.addExact(tempoffset,50)+'&limit=50':null}"
}
}

 

Case3. Pagination by page
It cannot be processed because there are no attributes other than the total number of data, the offset value transmitted when requesting, and whether or not there is an additional value.

 

 

 

"pagination":{
   "page":{
      "pageSizeParam":"pageSize",
      "pageSize":1000,
      "pageRecordCount":"completeResponseMap.pageSize",
      "pageNumberParam":"offset",
      "totalCountPath":"completeResponseMap.conflictcount",
      "firstPageNumber":1
   }
}

 

 

 

 

12 REPLIES 12

SB
Saviynt Employee
Saviynt Employee

You can use the below format 

Here the url will resolve to startIndex=1&count=50 and the 2nd url will be startIndex=51&count=50

"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.completeResponseMap?.itemsPerPage<50?null:'https://abc.oraclecloud.com/RestApi/scim/Users?startIndex='+Math.addExact(response.completeResponseM...'}"
}
}


Regards,
Sahil

HenryMK
New Contributor III
New Contributor III

response data only

 "employeesTotal": 1000,
 "hasMore": true,

ex)itemsPerPagem, startIndex ... does not contain the value I requested

SB
Saviynt Employee
Saviynt Employee

Can you elaborate on your previous comment. I am not sure what you mean.


Regards,
Sahil

HenryMK
New Contributor III
New Contributor III

response.completeResponseMap
> This syntax is known as extracting the data included in the response body data.

But. This is the entire response.

{
    "data": {
        "employeesTotal": 1000,
        "hasMore": true,
        "employeeData": [
            {
             ...
            }
        ]
    }
    "_statusCode": "200",
    "_statusText": "OK",
    "_statusMessage": "Success"
}

Math.addExact() , There are no variables to leverage scripts for page processing.
Including response headers.

I would like to know how I can continuously increment an arbitrary value by 50 or 100.
I want to set values 1, 51, 101, 151.... to variables like startIndex.

HenryMK
New Contributor III
New Contributor III

If offset is used in a different way
Is there a way to start from 1 rather than 0?
If it can start from 1, you can use offset.

"pagination": {
"offset": {
"offsetParam": "",
"batchParam": "",
"batchSize": ,
"totalCountPath": ""
}
}

 

SB
Saviynt Employee
Saviynt Employee

Using the above offset we will not be able to force the value to start from 1. Can you share the url format that we will see for different pages when using pagination. 

Also can you confirm the target application you are testing it for.

Did you get any error when you tried with the format I shared with you?


Regards,
Sahil

HenryMK
New Contributor III
New Contributor III

target application : Trinet
Call Url : GET https://api.trinet.com/{{version}}/company/{{companyId}}/employees?offset=1&limit=100
offset : Specify the starting record.
limit : Specify the number of returned records to control the data size ( max 100 )

I wonder if you understood the point of the question.
response data 

There is no variable to use Math.addExact() in the response value.
As I said repeatedly, there are only employeesTotal and hasMore values for unique page processing.
Of course, the method you gave me gives an error because Math.addExact() doesn't have a variable to use.

{
    "data": {
        "employeesTotal": 1000,
        "hasMore": true,
        "employeeData": [
            {
             ...
            }
        ]
    }
    "_statusCode": "200",
    "_statusText": "OK",
    "_statusMessage": "Success"
}

 

HenryMK
New Contributor III
New Contributor III

Is the content of the inquiry being reviewed or in progress?
No updates since ‎05-03-2023.

SB
Saviynt Employee
Saviynt Employee

We are checking this and will provide an update. 


Regards,
Sahil

prashantChauhan
Saviynt Employee
Saviynt Employee

Hi @HenryMK 

The REST Connector does not support setting the offset to 1 instead of 0.
Can you please share more information on what is the issue if we use offset as 0?
By looking at your API and its response, I believe you should be able to implement this by using the Offset Based pagination with the below sample properties-


"pagination": {
"offset": {
"offsetParam": "offset",
"batchParam": "limit",
"batchSize": 100,
"totalCountPath": "completeResponseMap.data.employeesTotal"
}
}

The question is simple. Offset=0 is not supported.
Target API should request an offset start from 1 for a normal response.
The target api says offset 0 is not supported.

http://<URL>?offset=0&limit=100    -> Error
http://<URL>?offset=1&limit=100    -> normal processing

I know that offset designation is not supported.
Is it possible to request a modification to the offset=1 feature?

prashantChauhan
Saviynt Employee
Saviynt Employee

Hi @HenryMK 

This modification is not currently supported in the REST Connector.

Please create it as an enhancement in the Ideas Portal with all the details for this to be handled.

Thanks.