Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Pagination Issue - Rest

SJ_544
New Contributor III
New Contributor III

@ShubhamBabbar 

I see a post from you that, you were able to resolve the pagination issue. Could you please share the full link as it was broken.

https://forums.saviynt.com/t5/identity-governance/rest-connector-offset-pagination/m-p/43765/thread-...


I am trying to resolve the pagination, but it is failing with errors.

This is my acctEntParams JSON

"acctEntParams": {
"connection": "userAuth",
"entTypes": {
"Teams": {
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"processingType": "httpAcctToEnt",
"http": {
"httpHeaders": {
"Authorization": "${access_token}"
},
"url": "https://SBUS.api.blackline.com/v1/users/${id}/teams",
"httpContentType": "application/json",
"httpMethod": "GET"
},
"listField": "items",
"entKeyField": "entitlementID",
"entIdPath": "id",
"acctKeyField": "accountID"
}
}
},
"Entities": {
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"processingType": "httpAcctToEnt",
"http": {
"httpHeaders": {
"Authorization": "${access_token}"
},
"url": "https://abc.com/v1/users/${id}/entities?pageStartIndex=0&count=25",
"httpContentType": "application/json",
"httpMethod": "GET"
},
"listField": "items",
"entKeyField": "entitlement_value",
"entIdPath": "name",
"acctKeyField": "accountID",
"pagination": {
"totalCountPath": "1000",
"nextUrl": {
"nextUrlPath": "${response.completeResponseMap.itemsPerPage<25?null:'http://abc.api.blackline.com/v1/users/${id}/entities?pageStartIndex='+Math.addExact(response.complet...}"
}
}
}
}
}
}
}

 

This is the pagination which i have added.

"pagination": {
"totalCountPath": "1000",
"nextUrl": {
"nextUrlPath": "${response.completeResponseMap.itemsPerPage<25?null:'http://abc.api.blackline.com/v1/users/${id}/entities?pageStartIndex='+Math.addExact(response.complet...}"
}
}

Response in Saviynt logs
responseText:{"itemsPerPage":2,"pageStartIndex":0,"items":[{"id":34567,"level":5,"name":"ICH and BACH","parentId":12345,"uniqueCode":"ICH"},{"id":32456,"level":8,"name":"DIVISION","parentId":null,"uniqueCode":"DIV"}],"totalItems":2}, cookies:[], statusCode:200]"
Job Failure Message


Error while getting entMappingParams Response WebService call failed with responseStatusCode nullFailed url-http://abc.com/v1/users/${id}/entities?pageStartIndex=25&count=25 for entType-Entities with Error Message-null


If possible, can you share the full nexturl. I tried with this also but it didn't worked.

"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.completeResponseMap?.itemsPerPage<25?null:'http://SBUS.api.blackline.com/v1/users/${id}/entities?count=25&pageStartIndex=%27+Math.addExact(resp...)}"
}
}


7 REPLIES 7

ShubhamBabbar
New Contributor III
New Contributor III

Hi @SJ_544 ,

The problem I had with pagination was that my API did not support StartIndex = 0 but started with StartIndex = 1,  which is different from your use case.

You can use the following pagination with offset

        "pagination": {
          "offset": {
            "offsetParam": "pageStartIndex",
            "batchParam": "count",
            "batchSize": 1000,
            "totalCountPath": "completeResponseMap.totalItems"
          }
        },

SJ_544
New Contributor III
New Contributor III

Hi @ShubhamBabbar - Tried this but it didn't worked. 

ShubhamBabbar
New Contributor III
New Contributor III

Please change your "url": "https://abc.com/v1/users/${id}/entities?"

ShubhamBabbar
New Contributor III
New Contributor III

Correction Please change your "url": "https://abc.com/v1/users/${id}/entities"

SJ_544
New Contributor III
New Contributor III

Tried already, but no luck.

ShubhamBabbar
New Contributor III
New Contributor III

Can you paste the entire json and what error are you seeing in logs?

SJ_544
New Contributor III
New Contributor III

@ShubhamBabbar  - I was able to resolve the issue. Application API is not giving the valid response. I have verified in the Response header (Link) there i found the batchParam name as  different than the response value. This is the correct Param "pageSize". 
Correct Pagniation Value for future reference

"pagination": {
"offset": {
"offsetParam": "pageStartIndex",
"batchParam": "pageSize",
"batchSize": 1000,
"totalCountPath": "completeResponseMap.totalItems"
}
}