Web Services Connector | Pagination through queryToken of 2 context URLs

Hi Experts,

We’re trying to achieve pagination for “Web Services” connector based source where it

  1. returns first 100 users + queryToken through POST BaseUrl\contextUrl1 (with no body)
  2. returns next 100 users + queryToken through POST BaseUrl\contextUrl2 (with queryToken received in step 1 in request body)
  3. returns next 100 users + queryToken through BaseUrl\contextUrl2 (with queryToken received in step 2 in request body)
  4. continues until we stop receiving queryToken in response

PAGINATION steps we’re trying:


TERMINATE_IF $response.queryToken$ == NULL
$endpoint.fullUrl$ = $application.baseUrl$ + "contextUrl2"
$request.queryToken$ = $response.queryToken$

We tried with no Request Body and $response.queryToken$ or $queryToken$ as Request Body but continue getting error " Query token does not have the proper format" with HTTP Error Code: 400.

Could you please advise on this ?

Hi @ikram_momin, @colin_mckibben

Could you please advise here ?

Can you please sample response from first request?? When this error occurs “Query token does not have the proper format” ?? When queryToken is not present in request or it’s format is not proper??

Hi @ikram_momin,

Here’s sample Response Body from first request:

 {

   "@type": "QueryResult",

   "queryToken": "QueryToken1",

   "result": [
                                 user 1
				 user 2
				 .
				 .
				 user n
             ],
 
}

queryToken is present but not in correct format. It’s expecting to have queryToken in TEXT format in Request Body but it seems that it’s being passed in JSON format.

I tried changing header “Content-Type” value from “application/json” to “text/plain” but continue facing same issues.

Any suggestions ?

Hi @atarodia,

Could you please advise here ?

Through the pagination steps, queryToken is being passed in JSON format but it’s expected in PLAIN TEXT format.

Is there a way to convert queryToken into PLAIN TEXT format during Pagination ?

Could you provide a functioning sample call from postman/curl along with the body? How are you configuring the request body in IDN?

Take a look at, might have something useful Paging Based on Request Body Configuration

Many thanks for responding, @M_rtenH.

Here are requested details:

  1. POST BaseUrl/ContextUrl1 call with no Request Body returns first 100 users and queryToken1 in this format:
{

   "@type": "QueryResult",

   "queryToken": "queryToken1",

   "result": [
                                 {user 1},
				 {user 2},
				 .
				 .
				 {user n}
             ],
 
}
  1. queryToken1 (Must be in PLAIN TEXT Format | must not be in Key-Value Pair format) received from step 1 is body of next POST call (POST BaseUrl\ContextUrl2), that returns next 100 users and queryToken2 in this format:
{

   "@type": "QueryResult",

   "queryToken": "queryToken2",

   "result": [
                                 {user 1},
				 {user 2},
				 .
				 .
				 {user n}
             ],
 
}
  1. queryToken2 received through step 2 will be used to get next 100 users + queryToken3 through POST BaseUrl/ContextUrl2. And this continues until we stop receiving queryToken in response.

Let me know if more details are required.

Hi @SailPoint_Learner,

  1. You could use Before/After operation rule to do the Aggregation call and pagination using the REST Client inside the rule itself.

  2. You could use Before and After Operation Rules Paging Configuration and set transient values map to do the pagination.

For your reference,

Hi @M_rtenH, @atarodia,

Is there a way to achieve pagination for this without rule ?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.