We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Need to do pagination using Headers

Akankshahanda
New Contributor II
New Contributor II

Hi Team,

We are trying to do pagination for accounts import for Adobe user management API.

The requirement is that we need to store the count of total pages, so that each time from the headers, we can increase the X-current page attribute by 1. We'll do this increment till the total count is reached and the last page attribute is true.

This is the URL that we are trying to hit:

https://usermanagement.adobe.io/v2/usermanagement/users/<orgID>/<pagenumber>

MicrosoftTeams-image (27).png

We want to increase page number till last page is "true"

MicrosoftTeams-image (28).png

The page number is stored at headers and not in response body. Could you please let us know the binding variable for this?

We have tried the following and they did not work:

+Math.addExact({headers?.X-Current-Page},1)

+math.addexact(Integer.parseInt(headers?.X-current page),1)

Could you please let us know how we can achieve this.

Regards,

Akanksha Handa

19 REPLIES 19

Hemanath
Saviynt Employee
Saviynt Employee

Hi @Akankshahanda ,

Try with below sample.

"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.objectList?.size()>0?'https://examplesaviyntcom/organization-api-service/v1/management-units?page='+Math.addExact(response...}"

Thanks,

Hemanath J

Suyash_Badnore1
New Contributor III
New Contributor III

Hi @Akankshahanda ,

We're also integrating same application and stuck with the same issue. I have tried the pagination example shared by @Hemanath but didn't work for us. Please let me know if anything worked for you and also pls share the JSON example.

 

Regards,

Suyash

Hemanath
Saviynt Employee
Saviynt Employee

Hi @Suyash_Badnore1 , can you share the pagination which you have used in json with api 

 

Hi @Hemanth ,

PFB the pagination JSON and suggest if any modification is required here, we're having only lastPage attribute in response:

"pagination": {
"nextUrl": {
"nextUrlPath": "${(response?.completeResponseMap?.lastPage==true)?null:'https://usermanagement.adobe.io/v2/usermanagement/users/<ORG_ID>/' + Math.addExact(response.completeResponseMap.headers.X-Current-Page,1)}"
}
}

 

Thanks,

Suyash

Hemanath
Saviynt Employee
Saviynt Employee

@Suyash_Badnore1 @Akankshahanda how you are getting the next page data either by modifying X-Current-Page in the headers or what

Suyash_Badnore1
New Contributor III
New Contributor III

@Hemanath , we're getting response as lastPage=true/false in response. In above example I was just trying if it would work using response headers, but it didn't work as well.

Hemanath
Saviynt Employee
Saviynt Employee

@Suyash_Badnore1 how you are getting the next data values from postman?

PFA the snapshots of response body & headers. The thing's we're not getting anyt nextURI or next_page values in the response body. Is there a way it would work with headers? Please help in understanding

Suyash_Badnore1_0-1680798504453.png

Suyash_Badnore1_1-1680798546875.png

 

Hemanath
Saviynt Employee
Saviynt Employee

Hi @Suyash_Badnore1 what data you will get when modifying X-Current-Page as 1 in postman

@Hemanath , when i update API with page number as 1 then it shows data of next page and X-Current-Page is updated as 1 :  https://<URL>/v2/usermanagement/users/<ORG_ID>/1

Suyash_Badnore1_0-1680799280166.png

 

Hemanath
Saviynt Employee
Saviynt Employee

@Suyash_Badnore1  can you try below

{
"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.objectList?.size()>0?'https://usermanagement.adobe.io/v2/usermanagement/users/<ORG_ID>/'+Math.addExact(headers?.X-Current-Page,1)+':null}"
}
}
}
}

@Hemanath I see below error:

Error - to Import Data correctly:
NullResponseFromTarget

Hi Hemanth,

We tried this exact same logic earlier, it did not work for us. Could you please suggest some other way to do this?

Regards,

Akanksha Handa

Hi Hemanth,

Could you please let us know if you were able to find something regarding the adobe pagination?

Regards,

Akanksha Handa

Hemanath
Saviynt Employee
Saviynt Employee

@Suyash_Badnore1 can you share your json

 

@Hemanath PFA,

 

Hello @Hemanath 

Could you please update us if you got a solution for this?

Regards,

Akanksha Handa

Suyash_Badnore1
New Contributor III
New Contributor III

Hi @Hemanath ,

 

Could you please help us with any suggestions or solution ?

 

 

Thanks,

Suyash

Hello team,

The attached json worked for us.

Regards,

Akanksha Handa