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 -
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-
- The httpParams are not getting calculated in call2 from call1. It's being passed as a string (in log file line 982,992)
- 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.
- Shouldn't the Pagination logic begin from Page 2 but in the image below from log, it starts from page 1-
{NOTE-MY API REQUIRES A RANDOM GUID TO BE SENT IN EVERY REQUEST MADE MANDATORILY}
ATTACHING LOGS
THANKING Again 🙂