Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

REST - Use response of first call in the URL of second call in ImportAccountEntJSON

Aditya
New Contributor
New Contributor

Hi,

 

I am trying to import entitlements in REST connector. There are 2 calls to get the entitlement data including pagination.

 

I want to use the response of CALL1 in the URL of CALL2 for ex:

Call 1 response: 

"jobReference": {
        "jobId": "job_Idpit3a53_sHs8XK1TZgiWpr5T7l"
    },
    "pageToken": "BHX4GTMSSAAQAAASA4EAAEEAQCAAKGQIBAABB7X7777QOIFQVYKUVLICBJ2AUIIKCZZGSYZNMRSXMLLOFVQXK5DIFVUHKYRNGR4DCEKJK6U7GQQAAAABEKK7GI2DSNJUMM4DKMLEMNQTMYZYMIZTGMBVMQ4DINRXMU3DEYZSGQ4DAYZXMY4TEYZUDISGIMBSMJRDMV3F62KVKB4FM3SEME2XSRKJIFHG64ZQMN3WG23HGVETERDHI5LEQMCJKJKS24ZRHAYXOVC2KE======"

 

Call 2 url: https://x.apis.com/big/v2/projects/ric-dev/queries/job_KkVNnGaDRWoiq7my_fXLiHIZ?pageToken=BFA6URMHSAAQAA...................&maxResults=40&timeoutMs=10 

 

I want to utilize the jobid and pageToken  in the URL of next call

I tried below approach but its giving error

"https://x.apis.com/big/v2/projects/ric-dev/queries/${response?.call1?.jobReference?.jobId}?pageToken..."

 

Error:

2024-07-08T19:03:29+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-4-bxh6g-DEBUG-Got null response statusCode with erroMsg - [error:Error Illegal character in path at index 85: https://x.apis.com/big/v2/projects/ric-dev/queries/${response?.call1?.jobReference?.jobId}?pageToken=${response?.call1?.pageToken}&maxResults=3000&timeoutMs=10]
 
2024-07-08T19:03:29+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-bxh6g-ERROR-Exception in getting response in pullObjectsByRest :
 
2024-07-08T19:03:29+05:30-ecm-worker--null-bxh6g--java.lang.Exception: NullResponseFromTarget at com.saviynt.provisoning.rest.RestUtilService.checkForErrorMsg(RestUtilService.groovy:1463) at com.saviynt.provisoning.rest.RestProvisioningService.pullObjectsByRest(RestProvisioningService.groovy:4551) at com.saviynt.provisoning.rest.RestProvisioningService.processEntitlementByPagination(RestProvisioningService.groovy:952) at com.saviynt.provisoning.rest.RestProvisioningService.processEntitlementByEntFilterAndNoFilter(RestProvisioningService.groovy:851) at com.saviynt.provisoning.rest.RestProvisioningService.processEntitlementsFinal(RestProvisioningService.groovy:695) at com.saviynt.provisoning.rest.RestProvisioningService.processAccessFullBySequentialAndIterative(RestProvisioningService.groovy:653) at com.saviynt.provisoning.rest.RestProvisioningService.importAccessFullBySequentialAndIterativeWithoutEntFilter(RestProvisioningService.groovy:530) at com.saviynt.provisoning.rest.RestProvisioningService.importAccessFullBySequentialAndIterative(RestProvisioningService.groovy:284) at com.saviynt.provisoning.rest.RestProvisioningService.importAccessFull(RestProvisioningService.groovy:170) at com.saviynt.provisoning.rest.RestProvisioningService.doImport(RestProvisioningService.groovy:144) at com.saviynt.ecm.integration.ExternalConnectionCallService.invokeExternalMethod(ExternalConnectionCallService.groovy:233) at SapImportJob.execute(SapImportJob.groovy:109) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
 
2024-07-08T19:03:29+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-4-bxh6g-DEBUG-Error while getting Access Import response for entType- business_area, url- https://x.apis.com/big/v2/projects/ric-dev/queries/${response?.call1?.jobReference?.jobId}?pageToken=${response?.call1?.pageToken}&maxResults=3000&timeoutMs=10 is: null

 

Json:

"entTypes": {
"business_area": {
"entTypeOrder": 0,
"call": {
"call1": {
"showJobHistory": true,
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://x.apis.com/big/v2/projects/ric-dev/queries",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpParams": "{\"defaultDataset\": {\"datasetId\": \"aditya\", \"projectId\": \"ric-dev\"}, \"dryRun\": false, \"kind\": \"bigquery#queryRequest\", \"maxResults\": 0, \"preserveNulls\": false, \"query\": \"SELECT id,attribute_id,attribute_value,attribute_value_displaytext,attribute_value_description FROM scm_attribute_values where attribute_id in (1)\", \"timeoutMs\": 10, \"useLegacySql\": false, \"useQueryCache\": true}",
"httpContentType": "application/json",
"httpMethod": "POST"
},
"disableDeletedEntitlements": true
},
"call2": {
"showJobHistory": true,
"callOrder": 1,
"stageNumber": 1,
"http": {
"url": "https://x.apis.com/big/v2/projects/ric-dev/queries/${response?.call1?.jobReference?.jobId}?pageToken...",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpMethod": "GET"
},
"listField": "rows.f",
"keyField": "entitlementID",
"colsToPropsMap": {
"entitlementID": "v[0]~#~char",
"entitlement_value": "v[0]~#~char",
"DISPLAYNAME": "v[2]~#~char",
"DESCRIPTION": "v[3]~#~char",
"ENTITLEMENT_GLOSSARY": "v[4]~#~char",
"acctEntMappingInfoColumnFromEnt": "STORE#ACC#ENT#MAPPINGINFO~#~char"
},
"pagination": {
"nextUrl": {
"nextUrlPath": "${response?.completeResponseMap?.pageToken==null?null:'https://x.apis.com/big/v2/projects/ric-dev/queries/' + response?.completeResponseMap?.jobReference.jobId + '?pageToken=' + response?.completeResponseMap?.pageToken + '&maxResults=10&timeoutMs=10'}"
}
},
"disableDeletedEntitlements": true
}
}
}
}

 

 

Thanks,

Aditya

7 REPLIES 7

rushikeshvartak
All-Star
All-Star

Call 1 response does not seems complete

Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

Hi Rushikesh,

 

The Json is working fine when I hardcode the Job ID and Page token values in URL like below:

https://dummy.com/queries/job_M2Hxq2-H?pageToken=BVC2KE======&maxResults=2&timeoutMs=10&location=eur...

It is not resolving the variables

https://dummy.com/queries/${response.call1.jobReference.jobId}?pageToken=${response.call1.pageToken}..."

 

Error:

Got null response statusCode with erroMsg - [error:Error Illegal character in path at index 85: https://dummy.com/queries/${response.call1.jobReference.jobId}?pageToken=${response.call1.pageToken}...]

 

Below is postman response of call1:

Aditya_0-1720528221274.png

 

cURL for call1:

curl --location 'https://dummy.com/queries' \
--header 'Content-Type: application/json' \
--header 'Authorization: XXX' \
--data '{
"defaultDataset": {
"datasetId": "iam",
"projectId": "p1"
},
"dryRun": false,
"kind": "q#queryRequest",
"location": "",
"maxResults": 1,
"parameterMode": "",
"preserveNulls": false,
"query": "SELECT id FROM scm_attribute_values where attribute_id in (1)",
"timeoutMs": 10,
"useLegacySql": false,
"useQueryCache": true
}'

 

cURL for call2:

curl --location 'https://dummy.com/queries/job_M2DC?pageToken=BGHIA&maxResults=2&timeoutMs=10&location=europe-west3' \
--header 'Authorization: XXX' \
--data ''

 

I have attached the import Json for reference.

 

Thanks,

Aditya Verma

Aditya
New Contributor
New Contributor

Hi @rushikeshvartak ,

 

Any idea on this?

 

Thanks

{
  "accountParams": {},
  "entitlementParams": {
    "connection": "oauthConnection",
    "processingType": "SequentialAndIterative",
    "successResponses": {
      "statusCode": [200]
    },
    "entTypes": {
      "business_area": {
        "entTypeOrder": 0,
        "call": {
          "call1": {
            "showJobHistory": true,
            "callOrder": 0,
            "stageNumber": 0,
            "http": {
              "url": "https://dummy.com/queries",
              "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
              },
              "httpParams": "{\"defaultDataset\": {\"datasetId\": \"iam\", \"projectId\": \"project\"}, \"dryRun\": false, \"kind\": \"q#queryRequest\", \"maxResults\": 20, \"preserveNulls\": false, \"query\": \"SELECT id,attribute_id,attribute_value,attribute_value_displaytext,attribute_value_description FROM scm_attribute_values where attribute_id in (1)\", \"timeoutMs\": 10, \"useLegacySql\": false, \"useQueryCache\": true}",
              "httpContentType": "application/json",
              "httpMethod": "POST"
            },
            "listField": "rows.f",
            "keyField": "entitlementID",
            "colsToPropsMap": {
              "entitlementID": "v[0]~#~char",
              "entitlement_value": "v[0]~#~char",
              "DISPLAYNAME": "v[2]~#~char",
              "DESCRIPTION": "v[3]~#~char",
              "ENTITLEMENT_GLOSSARY": "v[4]~#~char"
            },
            "disableDeletedEntitlements": true
          },
          "call2": {
            "showJobHistory": true,
            "callOrder": 1,
            "stageNumber": 2,
            "http": {
              "url": "https://dummy.com/queries/${response.call1.jobReference.jobId}?pageToken=${response.call1.pageToken}&maxResults=20&timeoutMs=10&location=europe-west3",
              "httpHeaders": {
                "Authorization": "${access_token}",
                "Accept": "application/json"
              },
              "httpContentType": "application/x-www-form-urlencoded",
              "httpMethod": "GET"
            },
            "inputParams": {
              "entitlementname": "business_area"
            },
            "listField": "rows.f",
            "keyField": "entitlementID",
            "colsToPropsMap": {
              "entitlementID": "v[0]~#~char",
              "entitlement_value": "v[0]~#~char",
              "DISPLAYNAME": "v[2]~#~char",
              "DESCRIPTION": "v[3]~#~char",
              "ENTITLEMENT_GLOSSARY": "v[4]~#~char"
            },
            "pagination": {
              "nextUrl": {
                "nextUrlPath": "${response.call1.pageToken == null ? null : 'https://dummy.com/queries/' + response.call1.jobReference.jobId + '?pageToken=' + response.call1.pageToken + '&maxResults=2&timeoutMs=10&location=europe-west3'}"
              }
            },
            "disableDeletedEntitlements": true
          }
        }
      }
    }
  },
  "acctEntParams": {}
}

Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

Hi @rushikeshvartak ,

 

The pagination block was working fine, I am facing issue in the URL of call2.

The response variable is not resolving in the URL:

 

"call2": {
"showJobHistory": true,
"callOrder": 1,
"stageNumber": 2,
"http": {
"url": "https://dummy.com/queries/${response.call1.jobReference.jobId}?pageToken=${response.call1.pageToken}&maxResults=20&timeoutMs=10&location=europe-west3",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpMethod": "GET"
}

 

Let me know how I can resolve this.

 

Thanks,

Aditya

${response.call1.message.jobReference.jobId}


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.

Hi @rushikeshvartak ,

 

I am getting below error in logs, I have put this variable in the URL ${response.call1.message.jobReference.jobId}

I think the URL is not resolving the dynamic variable "${}"

 

URL:

"url": "https://dummy.com/ric-dev4x1/queries/${response.call1.message.jobReference.jobId}?pageToken=${response.call1.message.pageToken}&maxResults=20&timeoutMs=10&location=europe-west3"

 

Error: 

Got Webservice API Response: [error:Error Illegal character in path at index 85: https://dummy.com/ric-dev-n-auth-hub-4x1/queries/${response.call1.message.jobReference.jobId}?pageTo...]

Got null response statusCode with erroMsg - [error:Error Illegal character in path at index 85: https://dummy.com/ric-dev-n-auth-hub-4x1/queries/${response.call1.message.jobReference.jobId}?pageTo...]

 

Error while getting Access Import response for entType- business_area, url- https://dummy.com/ric-dev-4x1/queries/${response.call1.message.jobReference.jobId}?pageToken=${respo... is: null

 

I am attaching the import json for reference. (line 90)

 

Thanks,

Aditya