Click HERE to see how Saviynt Intelligence is transforming the industry. |
05/02/2024 12:04 AM
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
]
}
}
]
}
05/02/2024 05:43 AM
Hi @jagadeeshdoma it could be because of encodeasbase64 function... Trying processing only one attribute and see then..
05/02/2024 09:45 PM
To narrow down problem did you tried with hardcoded values ?
05/03/2024 03:54 AM
Yes @rushikeshvartak ,
The JSON is working as expected with Hardcoded values.
Can you please help why the variables are not getting resolved?
Thanks,
Jagadeesh
05/04/2024 08:21 AM
Validate one by one which dynamic attributes is causing issue according to that we can suggest next steps
05/05/2024 09:56 PM - last edited on 05/05/2024 11:02 PM by Sunil
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]
05/05/2024 10:12 PM - edited 05/05/2024 10:14 PM
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..