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

Passing Attribute from 1st call to 2nd call in REST (import user json)

JasmeenB
New Contributor II
New Contributor II

Hi Team,

Usecase - Pass attributes from 1st call to 2nd call for multi api call in rest

1. We have HCM connection , we need to pass Person ID attribute of the worker to next API call to get the other relevant data.

Json:

{
"type": "multicall",
"call" : [
{
"name":"call1",
"connection": "userAuth",
"processingType": "SequentialAndIterative",
"url": "https://xxxx/hcmRestApi/resources/latest/workers?fields=PersonId,PersonNumber;externalIdentifiers:Ex...:;",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"},
"colsToPropsMap": {
"username": "PersonNumber~#~char",
"customproperty1": "PersonId~#~char",
"city": "addresses[0].TownOrCity~#~char",
"customproperty40":"externalIdentifiers.ExternalIdentifierType~#~char",
"customproperty41":"externalIdentifiers.ExternalIdentifierNumber~#~char",
"CostCenter":"workRelationships.assignments.DefaultExpenseAccount",
"customproperty30":"workRelationships.assignments.DepartmentName",
"CompanyName":"workRelationships.LegalEmployerName",
"customproperty6":"workRelationships.WorkerType",
"DisplayName":"names.DisplayName",
"PreferredFirstName":"names.KnownAs",
"Status": "workRelationships.assignments.AssignmentStatusType",
"JobFunction": "workRelationships.assignments.JobName",
"customproperty42":"workRelationships.assignments.GradeName",
"customproperty12":"workRelationships.assignments.GradeCode",
"customproperty13":"workRelationships.assignments.ActionName",
"customproperty14":"workRelationships.assignments.ReasonName",
"Country":"workRelationships.LegislationCode",
"customproperty15":"workRelationships.assignments.ManagerFlag"
},
"errorCode":"400",
"errorCodePath":"errorCode",
"userResponsePath": "items"
},
{
"name": "call2",
"connection": "userAuth",
"processingType": "SequentialAndIterative",
"url":"https://xxxx/hcmRestApi/resources/latest/publicWorkers/${response.call1.items.PersonId}",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"},
"colsToPropsMap": {
"firstname": "FirstName~#~char",
"lastname": "LastName~#~char",
"middlename": "MiddleNames~#~char"
},
"userResponsePath": ""
}
]
}

We have tried ${response.call1.items.PersonId}, ${.PersonId},${items.PersonId} in the 2nd call but still getting rest.RestUtilService - Got null response statusCode with erroMsg - null  Error.

Any Pointers are helpful here.

Regards,

Jasmeen

14 REPLIES 14

KhaoulaD
New Contributor III
New Contributor III

Hello,

Did you try with response.call1.message.PersonId ?

 

Regards,

Khaoula DOUHI

JasmeenB
New Contributor II
New Contributor II

Hi Khaoula,

This expression is not working.

The response for my request is

{
    "items": [
        {
            "PersonId"100000980446069,
            "PersonNumber""20008300",
            "externalIdentifiers": [
                {
                    "ExternalIdentifierId"300000618349511,
                    "ExternalIdentifierSequence"1,
                    "ExternalIdentifierNumber""24018",
                    "ExternalIdentifierType""MDR_BADGE_NBR",
                    "AssignmentId"null,
                    "FromDate""2020-05-01T12:00:00+00:00",
                    "ToDate""4712-12-31T12:00:00+00:00",
                    "Comments"null,
                    "AssignmentNumber"null,
                    "links": [
                        {
                            "rel""self",
                            "name""externalIdentifiers",
                            "kind""item",
                            "properties": {
                                "changeIndicator""ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A65787000000001770400000001737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000178"
                            }
                        },
                        {
                            "rel""canonical",
                            "name""externalIdentifiers",
                            "kind""item"
                        },
                        {
                            "rel""parent",
                            "name""workers",
                            "kind""item"
                        }
                    ]
                },
                {
                    "ExternalIdentifierId"300000618349070,
                    "ExternalIdentifierSequence"2,
                    "ExternalIdentifierNumber""33690",
                    "ExternalIdentifierType""MDR_LEGACY_EMPLOYEE_NBR",
                    "AssignmentId"null,
                    "FromDate""2020-05-01T12:00:00+00:00",
                    "ToDate""4712-12-31T12:00:00+00:00",
                    "Comments"null,
                    "AssignmentNumber"null,
                    "links": [
                        {
                            "rel""self",
                            "name""externalIdentifiers",
                            "kind""item",
                            "properties": {
                                "changeIndicator""ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A65787000000001770400000001737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000178"
                            }
                        },
                        {
                            "rel""canonical",
                            "name""externalIdentifiers",
                            "kind""item"
                        },
                        {

SB
Saviynt Employee
Saviynt Employee

You need to use dependentCall variable for this. Below is the link to REST Connector guide and you can refer to Common features section to check for the JSON example of dependentCall.

https://docs.saviyntcloud.com/bundle/REST-v2022x/page/Content/Developers-Handbook.htm


Regards,
Sahil

sambatipud
New Contributor
New Contributor

On behalf of Jasmeen-

we need some assistance here. Passing the Organization id as below is throwing est.RestUtilService - Got null response statusCode with erroMsg - null Error.

We have tried passing the attrbute as
q=OrganizationId=${userIdentifier.DepartmentId},
q=OrganizationId=${DepartmentId},
q=OrganizationId=${userIdentifier.customproperty43}

 

SB
Saviynt Employee
Saviynt Employee

You also need to use the dependentCall variable. 

Below is the link to REST Connector guide and you can refer to Common features section to check for the JSON example of dependentCall.

https://docs.saviyntcloud.com/bundle/REST-v2022x/page/Content/Developers-Handbook.htm


Regards,
Sahil

ashutoshkumar16
New Contributor II
New Contributor II

@sambatipud @JasmeenB , we are facing the same issue, were you have to resolve this issue? if yes could you please share the soultion?

What is the error you are getting. 

You need to use the dependentCall variable. 

Below is the link to REST Connector guide and you can refer to Common features section to check for the JSON example of dependentCall.

https://docs.saviyntcloud.com/bundle/REST-v2022x/page/Content/Developers-Handbook.htm


Regards,
Sahil

Please refer to the below REST connector developer handbook to use the multiple API call usage. 

rushikeshvartak_0-1688831067607.png

 

https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm

Let me know in case of any questions.


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

Thank @rushikeshvartak , I have added the dependent call vairable in the 2nd call of  multicall user import Json but still facing the same issue  and error explain above.

ashutoshkumar16
New Contributor II
New Contributor II

I am getting the same error as above in this Thread 

DEBUG rest.RestProvisioningService - Error while getting User Import response for url- https://XXXXXXXX/api/v1/positions/${customproperty15} is: null\n","stream":"stdout","time":"2023-07-09T06:31:04.309818527Z"}


rest.RestProvisioningService - Got Webservice API Response: [error:Error Illegal character in path at index 66: https://XXXXXXXX/api/v1/positions/${customproperty15}]\n","stream":"stdout","time":"2023-07-09T06:31...

I have added the dependent call variable in the second call 

"inputParams": {
"dependentCall": true
}

"nextApiKeyField": "username",

as Username is the binding variable from the first call assuming the user metadata from the first call is available in the URL and I tring to access customproperty15 that I have set but seems like it is not able to get the the variable.

Share full json


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

Attached.

1st call is creating the user but error is thorowing when saviynt goes for 2nd call. and position_id is mapped to customproperty15 in the first call and it is populating in the user profile

{
  "type": "multiCall",
  "call": [
    {
      "name": "call1",
      "connection": "userAuth",
      "url": "https://XXXXX/hr/hr-wfm/api/v1/employees?limit=2",
      "httpMethod": "GET",
      "httpHeaders": {
		"app_key": "<APP_KEY>",
        "Authorization": "${access_token}"
      },
      "colsToPropsMap": {
        "username":"payroll_id~#~char",
		  "systemUserName":"payroll_id~#~char",
		  "firstName":"first_name~#~char",
		  "lastName":"surname~#~char",
		  "customproperty15":"occupancy[0].position.position_id~#~char"
      },
      "userResponsePath": "employees"
    },
    {
      "name": "call2",
      "connection": "userAuth",
      "url": "https://XXXXXX/hr-wfm/api/v1/positions/${userIdentifier}",
      "httpMethod": "GET",
      "httpHeaders": {
		"app_key": "<APP_KEY>",
        "Authorization": "${access_token}"
      },
	  "inputParams": {
          "dependentCall": true
      },
	  "nextApiKeyField": "username",
      "colsToPropsMap": {
        "username": "assigned_to.value~#~char",
        "CUSTOMPROPERTY16": "position_title~#~char"
      },
      "userResponsePath": ""
    }
  ]
}

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

SB
Saviynt Employee
Saviynt Employee

Update the url for 2nd call as "url": "https://XXXXXX/hr-wfm/api/v1/positions/${userIdentifier}"

Note: The binding variable will always be ${userIdentifier} in the successive call and it will pick the value from first attribute mapping mentioned in the colsToPropsMap of the previous call. 

This post is continued over a diff thread 

https://forums.saviynt.com/t5/identity-governance/dependent-multiple-calls-in-importuserjson-rest-co...


Regards,
Sahil