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

Not able to resolve dynamic variables in CreateAccountJSON

jagadeeshdoma
New Contributor III
New Contributor III

Hi,

We're currently working on provisioning for a REST API application. This application exclusively accepts the payload/body of a POST API call in base64 encoded format. Below is the JSON we're utilizing for this purpose. However, we've encountered an issue where the dynamic variables aren't being resolved and are instead appearing as hardcoded strings.

{
  "call": [
    {
      "name": "call1",
      "connection": "userAuth",
      "url": "https://<App_URL>/api/v1/User/CreateUpdateUser",
      "httpHeaders": {
        "contentType": "text/plain",
        "Authorization": "${access_token}"
      },
      "httpContentType": "text/plain",
      "httpMethod": "POST",
      "httpParams": "${String payload='{\"credentialSourceId\":\"<hardcodedID>\",\"userName\":\"${user.username}\",\"firstName\":\"${user.firstname}\",\"email\":\"${user.email}\",\"lastName\":\"${user.lastname}\",\"company\":\"IT\",\"opuIds\":[],\"locationIds\":[],\"isActive\":true,\"moduleIds\":[],\"listUserRoleIds\":[],\"moduleDisciplineIds\":null,\"disciplineIds\":[],\"subDisciplineIds\":[],\"superiorLevel1\":null,\"department\":\"IT\",\"isTrainedRALeaderEMOC\":\"\",\"isHazopLeader\":\"\",\"isTA\":false,\"userRoles\":[]}'; return payload.encodeAsBase64();}",
      "successResponses": {
        "statusCode": [
          200
        ]
      }
    }
  ]
}
6 REPLIES 6

NM
Regular Contributor III
Regular Contributor III

Hi @jagadeeshdoma it could be because of encodeasbase64 function... Trying processing only one attribute and see then..

rushikeshvartak
All-Star
All-Star

To narrow down problem did you tried with hardcoded values ?


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

Yes @rushikeshvartak ,
The JSON is working as expected with Hardcoded values.
Can you please help why the variables are not getting resolved?

Thanks,
Jagadeesh

Validate one by one which dynamic attributes is causing issue according to that we can suggest next steps


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

jagadeeshdoma
New Contributor III
New Contributor III

Hi @rushikeshvartak ,

Below is the value I see in logs:

2024-05-03/11:46:19.322 [{}] [quartzScheduler_Worker-1] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://removed/api/v1/User/CreateUpdateUser  with httpParams - eyJjcmVkZW50aWFsU291cmNlSWQiOiIwOGI0MDNlOC02MDIzLTQ3NGEtOTJhZi0yMGZiOGRmNGUzNjYiLCJ1c2VyTmFtZSI6IiR7dXNlci51c2VybmFtZX0iLFwiZmlyc3ROYW1lXCI6XCIke3VzZXIuZmlyc3RuYW1lfVwiLFwiZW1haWxcIjpcIiR7dXNlci5lbWFpbH1cIixcImxhc3ROYW1lXCI6XCIke3VzZXIubGFzdG5hbWV9XCIsXCJjb21wYW55XCI6XCJGUFRcIixcIm9wdUlkc1wiOltdLFwibG9jYXRpb25JZHNcIjpbXSxcImlzQWN0aXZlXCI6dHJ1ZSxcIm1vZHVsZUlkc1wiOltcImVkZDA2ODY3LTMxZGUtNGNhZS1hOTdiLTI0YmZlOWMwMDdiYlwiXSxcImxpc3RVc2VyUm9sZUlkc1wiOltdLFwibW9kdWxlRGlzY2lwbGluZUlkc1wiOm51bGwsXCJkaXNjaXBsaW5lSWRzXCI6W10sXCJzdWJEaXNjaXBsaW5lSWRzXCI6W10sXCJzdXBlcmlvckxldmVsMVwiOm51bGwsXCJkZXBhcnRtZW50XCI6XCJGSE1cIixcImlzVHJhaW5lZFJBTGVhZGVyRU1PQ1wiOlwiXCIsXCJpc0hhem9wTGVhZGVyXCI6XCJcIixcImlzVEFcIjpmYWxzZSxcInVzZXJSb2xlc1wiOltdfQ==
2024-05-03/11:46:19.322 [{}] [quartzScheduler_Worker-1] DEBUG services.HttpClientUtilityService - calling executeRequestWithTimeoutConfig for api...

 

When I decode the encoded value above I get below value:

{"credentialSourceId":"08b403e8-6023-474a-92af-20fb8df4e366","userName":"${user.username}",\"firstName\":\"${user.firstname}\",\"email\":\"${user.email}\",\"lastName\":\"${user.lastname}\",\"company\":\"FPT\",\"opuIds\":[],\"locationIds\":[],\"isActive\":true,\"moduleIds\":[\"edd06867-31de-4cae-a97b-24bfe9c007bb\"],\"listUserRoleIds\":[],\"moduleDisciplineIds\":null,\"disciplineIds\":[],\"subDisciplineIds\":[],\"superiorLevel1\":null,\"department\":\"FHM\",\"isTrainedRALeaderEMOC\":\"\",\"isHazopLeader\":\"\",\"isTA\":false,\"userRoles\":[]}

 

Regards,

Jagadeesh

[This message has been edited by moderator to mask url]

NM
Regular Contributor III
Regular Contributor III

Hi @jagadeeshdoma,

Update your http param field as below-

${String payload='{\"credentialSourceId\":\"<hardcodedID>\",\"userName\":\"'+user.username+'\",\"firstName\":\"'+user.firstname+'\",\"email\":\"'+user.email+'\",\"lastName\":\"'+user.lastname+'\",\"company\":\"IT\",\"opuIds\":[],\"locationIds\":[],\"isActive\":true,\"moduleIds\":[],\"listUserRoleIds\":[],\"moduleDisciplineIds\":null,\"disciplineIds\":[],\"subDisciplineIds\":[],\"superiorLevel1\":null,\"department\":\"IT\",\"isTrainedRALeaderEMOC\":\"\",\"isHazopLeader\":\"\",\"isTA\":false,\"userRoles\":[]}'; return payload.encodeAsBase64();}

@rushikeshvartak , your input if something has to be corrected..