05/19/2023 05:08 PM - edited 05/20/2023 09:36 AM
How do i remove special characters from below response that i get after create account. this responseMessage is mapped to accountIdPath
"message":{"responseMessage":"\"233d71ef-e211-4e7e-958f-2a875c172f50\""}
i tried "accountIdPath": "${call1.message.responseMessage.substring(1,-1)}", its not working
Here the createAccountjson
{
"accountIdPath": "call1.message.responseMessage",
"responseColsToPropsMap": {
"displayName": "call1.message.fullname~#~char",
"name": "call1.message.email~#~char",
"customproperty1": "call1.message.email~#~char"
},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://api5.fastpathassure.com/api/core/users",
"httpMethod": "POST",
"httpParams": "{\"Email\": \"${user.email}\", \"FirstName\": \"${user.preferedFirstName}\",\"LastName\": \"${user.lastname}\", \"IdentityProviderId\": \"XXXXXX\", \"IdentityUserId\": \"${user.email}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"TenantId": "XXXXXX"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200
]
},
"unsuccessResponses": {
"statusCode": [
500,
403,
409,
400
]
}
}
]
}
Account ID are stored with double quotes (see below)
Solved! Go to Solution.
05/21/2023 10:33 PM
Hello @npise
You May try replacing the account id path and check if it works.
"call1.message.responseMessage.replaceAll('\"', '')"
or
"${call1.message.responseMessage.replace(/"/g, '')}"
For Ref:-
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm
05/21/2023 10:39 PM - edited 05/21/2023 10:40 PM
"accountIdPath": "call1.message.id.toString().replaceAll('\"','')",
05/22/2023 09:09 AM
@rushikeshvartak @sudeshjaiswal thank for your response.
its not working. i tried the below:
"accountIdPath": "call1.message.id.toString().replaceAll('\"','')"
"accountIdPath": "call1.message.responseMessage.toString().replaceAll('\"','')"
please suggest!
05/22/2023 02:27 PM
Is there any error
05/22/2023 02:29 PM
No there is no error.
As per developers handbook will the below work?
"accountIdPath": "#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.replace('\"',''); return acctId}"
05/22/2023 02:31 PM
Use toString()
05/22/2023 02:32 PM
like this??
"accountIdPath": "#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.toString().replace('\"',''); return acctId}"
05/22/2023 02:43 PM
this worked!! thank you!
05/22/2023 10:34 PM
Hello @npise
Please try this.
{
"accountIdPath":"#CONST#${String acctId = response.call1.message.responseMessage; acctId = acctId.toString().replace('\"',''); return acctId}",
"responseColsToPropsMap":{
"displayName":"call1.message.fullname~#~char",
"name":"call1.message.email~#~char",
"customproperty1":"call1.message.email~#~char"
},
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https://api5.fastpathassure.com/api/core/users",
"httpMethod":"POST",
"httpParams":"{\"Email\": \"${user.email}\", \"FirstName\": \"${user.preferedFirstName}\",\"LastName\": \"${user.lastname}\", \"IdentityProviderId\": \"XXXXXX\", \"IdentityUserId\": \"${user.email}\"}",
"httpHeaders":{
"Authorization":"${access_token}",
"TenantId":"XXXXXX"
},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
200
]
},
"unsuccessResponses":{
"statusCode":[
500,
403,
409,
400
]
}
}
]
}
Thanks