and more in a single search tool across platforms. Read the announcement here. |
04/07/2023 03:00 AM
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
04/07/2023 05:52 AM
Hello,
Did you try with response.call1.message.PersonId ?
Regards,
Khaoula DOUHI
04/07/2023 09:32 AM - edited 04/07/2023 09:33 AM
Hi Khaoula,
This expression is not working.
The response for my request is
04/10/2023 09:29 AM
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
04/13/2023 11:33 AM
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}
04/13/2023 11:46 AM
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
07/03/2023 04:30 AM
@sambatipud @JasmeenB , we are facing the same issue, were you have to resolve this issue? if yes could you please share the soultion?
07/07/2023 11:18 AM
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
07/08/2023 08:44 AM
Please refer to the below REST connector developer handbook to use the multiple API call usage.
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm
Let me know in case of any questions.
07/09/2023 09:31 PM
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.
07/09/2023 09:28 PM
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.
07/09/2023 10:51 PM
Share full json
07/09/2023 11:26 PM
07/19/2023 08:30 PM
{
"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": ""
}
]
}
07/19/2023 08:53 AM
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