sup3rmark
(Mark Corsillo)
May 28, 2024, 3:55pm
1
When I try to implement pagination on a custom web services connector (for Lenel OnGuard using the OpenAccess module), I get an error message: sailpoint.connector.ConnectorException: Error: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
If I remove the pagination config, I can retrieve the results for Page 1 with no error. The response body includes an attribute called page_number
with the current page number as well as total_pages
with the total number of pages. The page number we want should be passed in as a query param in the URL.
I’ve tried many things, all with the same error message:
Attempt 1:
TERMINATE_IF $NO_RECORDS$
$offset$ = $offset$ + 1
$endpoint.fullUrl$ = "https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.6&queue=false&page_size=10&page_number=" + $offset$
Attempt 2:
$nextpage$ = 0
$inc$ = 1
TERMINATE_IF $response.page_number$ == $response.total_pages$
$nextpage$ = $nextpage$ + $inc$
$endpoint.fullUrl$ = "https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.0&queue=false&page_size=10&page_number=" + $nextpage$
Attempt 3:
TERMINATE_IF $response.total_pages == $response.page_number
#set($nextPage = $response.page_number + 1)
$endpoint.fullURL = $application.baseUrl$ + $endpoint.contextUrl$ + "&page_number=" + $nextPage
Attempt 4:
$limit$ = 10
TERMINATE_IF $response.total_pages$ == $response.page_number$
$offset$ = $offset$ + 1
$endpoint.fullUrl$ = $application.baseUrl$ + $endpoint.relativeUrl$ + "&page_number=" + $offset$
Any guidance? Thanks in advance!
kjakubiak
(Kamil Jakubiak)
May 28, 2024, 4:16pm
2
Can you show example of response with paging attributes?
sup3rmark
(Mark Corsillo)
May 28, 2024, 5:18pm
3
The response looks like this:
{
"count": 20,
"item_list": [
...
],
"page_number": 1,
"page_size": 20,
"total_items": 22134,
"total_pages": 1107,
"version": "1.0"
}
The item_list
array contains all of the individual records, and the Root Path
on the Response Information
tab is se tto $.item_list
.
ipobeidi
(Ivan Obeidi)
May 28, 2024, 5:20pm
4
@sup3rmark try this :
$page$ = 1
$pg_limit$ = 100
TERMINATE_IF $RECORDS_COUNT$ < $pg_limit$
$pg_offset$ = $pg_offset$ + $page$
$endpoint.fullUrl$ = https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.0&queue=false&page_size=10&page_number=" + $page$
sup3rmark
(Mark Corsillo)
May 28, 2024, 5:25pm
5
@ipobeidi Same error, unfortunately
sailpoint.connector.ConnectorException: Error: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
$page$ = 1
$pg_limit$ = 10
TERMINATE_IF $RECORDS_COUNT$ < $pg_limit$
$pg_offset$ = $pg_offset$ + $page$
$endpoint.fullUrl$ = "https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.6&queue=false&page_size=10&page_number=" + $pg_offset$
1 Like
Hi @sup3rmark ,
Try this hope this works,
$page$ = 1
$pg_limit$ = 10
$pg_offset$ = 1
TERMINATE_IF $response.page$ < $response.total_pages$
$pg_offset$ = $pg_offset$ + $response.page$
$endpoint.fullUrl$ = “https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.6&queue=false&page_size=10&page_number=” + $pg_offset$
Thanks
1 Like
sup3rmark
(Mark Corsillo)
May 28, 2024, 6:14pm
7
Karthikeyan Udhayasurian:
$page$ = 1
$pg_limit$ = 10
$pg_offset$ = 1
TERMINATE_IF $response.page$ < $response.total_pages$
$pg_offset$ = $pg_offset$ + $response.page$
$endpoint.fullUrl$ = “https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.6&queue=false&page_size=10&page_number=” + $pg_offset$
Thanks for the suggestion, @Karthikeyan_U , but there is no page
attribute in the response, just page_number
, and we’d always want page_number
< total_pages
. Additionally, you’re adding $pg_offset$
to the page number of the response, which would result in skipping most pages. This one’s not going to work either, unfortunately.
1 Like
Hi @sup3rmark ,
Thanks for the correction, yes it should be a page_number instead of “page”. However, have you tried this URL in Postman and it’s working?
https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.6&queue=false&page_size=10&page_number=10
Also, what different attributes are available in the response headers? and what is response Information config: $ or $.item_list?
Updated Paging Code:
$page$ = 1
$pg_limit$ = 10
TERMINATE_IF $response.page_number$ < $response.total_pages$
$pg_offset$ = $response.page_number$ + 1
$endpoint.fullUrl$ = “https://[server]/api/access/onguard/openaccess/cardholders?auto_load_badge=false&auto_load_multimedia_object=false&auto_load_access_level=false&auto_load_reader=false&auto_load_timezone=false&auto_load_timezone_interval=false&version=1.6&queue=false&page_size=10&page_number=” + $pg_offset$
1 Like
sup3rmark
(Mark Corsillo)
May 28, 2024, 6:43pm
9
Yes, it works as expected in Postman.
The response headers have nothing of any use as far as pagination, unfortunately. As mentioned above, the Root Path
on the Response Information
tab is se tto $.item_list
.
Unfortunately, still no dice with that updated code.
1 Like
sup3rmark
(Mark Corsillo)
May 29, 2024, 4:08am
10
Hey all,
Thanks for the suggestions here. Turns out, the issue was actually with the Custom Authentication configuration, and not actually a pagination issue at all. That said, here’s the final (working) pagination config:
TERMINATE_IF $response.page_number$ == $response.total_pages$
$offset$ = $offset$ + 1
$endpoint.fullUrl$ = $application.baseUrl$ + $endpoint.relativeUrl$ + "&page_number=" + $offset$
1 Like
system
(system)
Closed
July 28, 2024, 4:08am
11
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.