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

Dynamic httpParams -REST

ag420
Regular Contributor
Regular Contributor

Hello Experts 🙂

Can anyone confirm if we can captures httpparams from call1 for call2 in UserImportJSON. My try -

{
  "type": "multiCall",
  "call": [
    {
      "name": "call1",
    "connection": "acctAuth",
  "successResponses": {
    "statusCode": [
      200
    ]
  },
  "url": "https://<removed>/api/workerdata?workerData=fullData&workerType=workerdetails",
  "httpMethod": "GET",
  "httpHeaders": {
    "Authorization": "${access_token}",
    "Accept":"application/json",
    "client_id":"<removed>",
    "client_secret":"<removed>,
    "x-correlation-id":"${java.util.UUID.randomUUID().toString()}"
  },
  "httpParams": "{}",
  "httpContentType":"application/json",
  "userResponsePath": "data",
  "colsToPropsMap": {
    "customproperty2": "personId~#~char",
    "SITEID": "workerDetails.position.orgPath~#~char"
  }
    },
    {
      "name": "call2",
      "connection": "acctAuth",
      "url": "<removed>api/workerdata?workerData=fullData&workerType=workerdetails&page=2&pageSize=100",
      "httpMethod": "GET",
      "httpParams": "{\"asOf\":\"${response.call1.message.asOf}\"}",
      "httpHeaders": {
        "Authorization": "${access_token}",
        "Accept":"application/json",
        "client_id":"<removed>",
        "client_secret":"<removed>",
        "x-correlation-id":"${java.util.UUID.randomUUID().toString()}"
      },
      "colsToPropsMap": {
    "customproperty2": "personId~#~char",
    "SITEID": "workerDetails.position.orgPath~#~char"
  },
      "userResponsePath": ""
    }
  ]
}
 
NOTE - THIS IS THE RESPONSE FROM CALL1-
ag420_0-1721333595216.png
I basically need the 'asOf' value to pass as httpParams in the next call.
 
Thanking in advance 
6 REPLIES 6

rushikeshvartak
All-Star
All-Star

Syntax is correct. Are you facing any errors ? please share logs


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

ag420
Regular Contributor
Regular Contributor

 

Ok, so it's not working. I will separate the issue in points and describe my usecase -

USECASE- I have made a REST connector for a REST endpoint. It has pagination with following response -

ag420_0-1721396332592.png

This is the first page response by just hitting the API url without passing page and page size . In other words, below JSON works (ignoring pagination)-

{
  "connection": "acctAuth",
  "successResponses": {
    "statusCode": [
      200
    ]
  },
  "url": "https://<removed>/api/workerdata?workerData=fullData&workerType=workerdetails",
  "httpMethod": "GET",
  "httpHeaders": {
    "Authorization": "${access_token}",
    "Accept":"application/json",
    "client_id":"<removed>",
    "client_secret":"<removed>",
    "x-correlation-id":"${java.util.UUID.randomUUID().toString()}"
  },
  "httpParams": "{}",
  "httpContentType":"application/json",
  "userResponsePath": "data",
  "colsToPropsMap": {
    "customproperty2": "personId~#~char",
    "SITEID": "workerDetails.position.orgPath~#~char"
  }}
 
Now after considering Pagination, i have come up with following JSON -
{
"type": "multiCall",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"successResponses": {
"statusCode": [
200
]
},
"url": "https://<REMOVED>/api/workerdata?workerData=fullData&workerType=workerdetails",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept":"application/json",
"client_id":"<REMOVED>",
"client_secret":"<REMOVED>",
"x-correlation-id":"${java.util.UUID.randomUUID().toString()}.${Calendar.instance.format('dd-MMM-yy-hh:mm:ss')}"
},
"httpParams": "{}",
"httpContentType":"application/json",
"userResponsePath": "data",
"colsToPropsMap": {
"customproperty2": "personId~#~char",
"SITEID": "workerDetails.position.orgPath~#~char"
}
},
{
"name": "call2",
"connection": "acctAuth",
"url": "https://<REMOVED>/workerdata?workerData=fullData&workerType=workerdetails",
"httpMethod": "GET",
"httpParams": "{\"asOf\":\"${response.call1.message.asOf}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept":"application/json",
"client_id":"<REMOVED>",
"client_secret":"<REMOVED>",
"x-correlation-id":"${java.util.UUID.randomUUID().toString()}.(${Calendar.instance.format('dd-MMM-yy-hh:mm:ss')})"
},
"colsToPropsMap": {
"customproperty2": "personId~#~char",
"SITEID": "workerDetails.position.orgPath~#~char"
},
"userResponsePath": "data",
"pagination": {
"page": {
"pageSizeParam": "pageSize",
"pageSize": 100,
"pageRecordCount": "completeResponseMap.records",
"pageNumberParam": "page",
"totalCountPath": "completeResponseMap.totalRecords",
"firstPageNumber": 1
}
}
}
]
}

ISSUE-

  1. The httpParams are not getting calculated in call2 from call1. It's being passed as a string (in log file line 982,992)
  2. Why is Saviynt sending the same x-correlation-id header in the next call for Pagination? Are values cached once JSON is built ? Because on executing the above JSON - it iterates again through the first page but for next page i get an error as found in Saviynt logs and job log page-
    Failed url-https://<removed>/api/workerdata?workerData=fullData&asOf=-<removed>&workerType=workerdetails&pageSize=100&page=2 with Error Message-{ "code": 500, "errorType": "MULE:ANY", "message": "You cannot use an existing correlation id", "correlationId": "<removed>", "timestamp": "2024-07-18T07:48:22.57Z", "detail": "You cannot use an existing correlation id", "instance": "<removed>xml:127 (You cannot use an existing correlation id)" } (in log file line 766,962)
     
    Meaning of above is basically the httpheader passed  "x-correlation-id":"${java.util.UUID.randomUUID().toString()}.(${Calendar.instance.format('dd-MMM-yy-hh:mm:ss')})"is the same one sent in for PAGE=1 i.e. its not getting computed after pagination logic executes.
  3. Shouldn't the Pagination logic begin from Page 2 but in the image below from log, it starts from page 1- ag420_1-1721397401813.png

     

{NOTE-MY API REQUIRES A RANDOM GUID TO BE SENT IN EVERY REQUEST MADE MANDATORILY}

ATTACHING LOGS

THANKING Again 🙂

concate datetime


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

ag420
Regular Contributor
Regular Contributor

already did that as posted in my previous coment's JSON , its not working

"x-correlation-id":"${java.util.UUID.randomUUID().toString()}.(${Calendar.instance.format('dd-MMM-yy-hh:mm:ss')})"
},

ag420
Regular Contributor
Regular Contributor

It calculates the random UUID along with system time once and then sends the same value in the next request. Please check the logs attached

It seems pagination is not recalculating it. Please raise support ticket


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.