raibom
(Bruno Souza)
October 11, 2024, 9:51pm
1
I have an API where pagination need to work as follows:
{{baseUrl}}/v1/users?index=1&size=100
{{baseUrl}}/v1/users?index=2&size=100
{{baseUrl}}/v1/users?index=3&size=100
{{baseUrl}}/v1/users?index=4&size=100
{{baseUrl}}/v1/users?index=5&size=100
The first call always returns the first 100 records:
The response looks like this:
{
"users": [...],
"pagination": {
"lastPage": false,
"total": 521,
"pageCount": 6
}
}
After return all records:
{
"users": [],
"pagination": {
"lastPage": true,
"total": 0,
"pageCount": 0
}
}
My pagination on sailpoint was configured like this:
TERMINATE_IF $offset$ > $response.pagination.pageCount$
$offset$ = $offset$ + 1
$endpoint.fullUrl$ = $application.baseUrl$ + "/v1/users?index="+$offset$+"&size="+$limit$
After aggregation, it only returns the first 100 accounts. I’ve seen several examples and I can’t understand why it doesn’t work.
Can anyone help me?
shaileeM
(Shailee Mehta)
October 14, 2024, 1:50am
2
MeKhalbi
(Mehdi Khalbi)
October 14, 2024, 11:28am
3
Hi @raibom , can you please try the following paging config ?
> $size$ = 100
> TERMINATE_IF $RECORDS_COUNT$ < $size$
> $index$ = $index$ + 1
> $endpoint.fullUrl$ = $application.baseUrl$ + "/v1/users?index=" + $index$ + "&size=100"
raibom
(Bruno Souza)
October 14, 2024, 12:37pm
4
Hi @MeKhalbi ,
It didn’t work either. What I see here is that the iteration increment doesn’t work. Shouldn’t this work since the documentation examples use it this way?
raibom
(Bruno Souza)
October 14, 2024, 12:45pm
5
@shaileeM In the example provided, it worked when pagination was done through the response header. This does not apply to my case because I do not have pagination information in the header.
schattopadhy
(SHANTANU CHATTOPADHYAY)
October 14, 2024, 2:03pm
6
@raibom you can try something like this
TERMINATE_IF $response.$content[*].enabled$ == NULL
paste code here
jesvin90
(Jesvin Joseph)
October 14, 2024, 2:12pm
7
Hi @raibom ,
Have you tried adding a value for $limit$ or hardcoding the value (100) directly in the $endpoint.fullUrl$.?
$limit$ = 100
TERMINATE_IF $offset$ > $response.pagination.pageCount$
$offset$ = $offset$ + 1
$endpoint.fullUrl$ = $application.baseUrl$ + "/v1/users?index="+$offset$+"&size="+$limit$
You may also want to try out with the initial offset value as 0.
Also, try out a different terminate condition as below :
TERMINATE_IF $response.pagination.lastPage$ == true
raibom
(Bruno Souza)
October 14, 2024, 2:49pm
8
Hi @jesvin90 ,
As I showed in the last image of the post, it is configured in the page size and page offset variables.
I tried it the way you showed and it returns a maximum of 200 records.
raibom
(Bruno Souza)
October 14, 2024, 9:46pm
9
I was able to implement pagination after asking the team responsible for the system to make a change to the API.
Talking to Sailpoint support, it seems that the response always needs to bring pagination information, either in the response body or header, so that this dynamic data can be iterate, thus creating the next URL. Iterating heardcoded does not work (although it is stated in the documentation, this seems to only work in the documentation system).
A change was made to the API, bringing another attribute called “page”, which indicates the current page, as shown below:
{
"users": [...],
"pagination": {
"lastPage": false,
"total": 521,
"pageCount": 6,
"page": 1,
"index": "bi004870"
}
}
The code was like this:
TERMINATE_IF $response.pagination.lastPage$ == true
$page$ = $response.pagination.page$ + 1
$endpoint.fullUrl$ = $application.baseUrl$ + "/v1/users?index=" + $page$ + "&size=100"
system
(system)
Closed
December 13, 2024, 9:46pm
10
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.