03/28/2023 10:07 AM
Hi ,
We are calling below URL on 'Add Access' , its throwing "java.lang.IllegalArgumentException: Illegal character in path at index 40:" this comes at $ (posiiton),
https://xxxxxxx/api/v1/products/${entitlementValue.customproperty1}/users
I have tried below but no luck.
https://xxxxxxx/api/v1/products/${encodeURIComponent(entitlementValue.customproperty1)}/users
Can any one give inputs whats wrong here.
Solved! Go to Solution.
03/28/2023 11:08 AM
Hi @IAM_99 ,
what type of value hold by customproperty1?. is it having any special char or spaces in between?
if you wish to endcode the value use "https://xxxxxxx/api/v1/products/${java.net.URLEncoder.encode(entitlementValue.customproperty1,java.nio.charset.StandardCharsets.UTF_8.toString())}"
Thanks,
Hemanath J
03/28/2023 11:11 AM
Its String value, no spaces this is the actual value : 6603028474658293963
03/28/2023 11:30 AM
its the same exception - some how its not able to evaluate from $onwords
Got Webservice API Response: [error:Error Illegal character in path at index 40: https://xxxxx.xx.xx/api/v1/products/${java.net.URLEncoder.encode(entitlementValue.customproperty1,java.nio.charset.StandardCharsets.UTF_8.toString())}/users
03/28/2023 11:39 AM
can you add complete log here
03/28/2023 11:46 AM
03/28/2023 11:55 AM
can you try making call with https://xxxxx.xx.xx/api/v1/products/${entitlementValue.customproperty1}
don't add /users after ${entitlementValue.customproperty1}
Thanks,
Hemanath J
04/03/2023 11:25 PM
tried already , Its the same wherever $ start it gives that exception.
03/28/2023 12:08 PM
PFB, same exception
Illegal character in path at index 40: https://xxxxxxx.xxx.xx/api/v1/products/${entitlementValue.customproperty1}\u001b[m\n","stream":"stdout","
04/03/2023 10:55 PM
Hello @IAM_99 ,
Instead, You may try to use
"url": "https://xxxxxx/api/v2/users/${entitlementValue.customproperty1}"
or
"url": "https://xxxxxx/api/v1/users/${entitlementValue.customproperty1}"
Ref:- https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Examples-for-JSON-Construction.htm
Thanks,
04/03/2023 11:29 PM
Could you elaborate more on this, i am not able to make difference ( v1 is the valid url we dont have v2)
"url": "https://xxxxxx/api/v2/users/${entitlementValue.customproperty1}"
or
"url": "https://xxxxxx/api/v1/users/${entitlementValue.customproperty1}"
Issue is happening from $ ( ${entitlementValue.customproperty1} is not able to resolve )
04/04/2023 07:41 AM
04/03/2023 11:45 PM
Hello @IAM_99 ,
Can you please share the JSON?
Thanks,
04/04/2023 11:18 AM
PFB
{
"accountIdPath": "accountName",
"call": [{
"name": "call1",
"connection": "userAuth",
"url": "https://xxxxxxx.aha.io/api/v1/products/${entitlementValue.customproperty1}/users",
"httpMethod": "POST",
"httpParams": "{\"user\": {\"email\": \"${user.email}\",\"first_name\": \"${user.firstname}\", \"last_name\": \"${user.lastname}\" , \"role\": \"${entitlementValue.entitlementID}\"}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200, 201
]
}
}]
}
04/04/2023 11:44 AM
04/04/2023 12:10 PM
Hi Hemanht,
above is Create Account JSON, below is Add Access JSON
{
"call": [{
"name": "product_roles",
"connection": "userAuth",
"entVal": "${entitlementValue.customproperty1}",
"url": "https://xxxxxx.aha.io/api/v1/products/${entitlementValue.customproperty1}/users",
"httpMethod": "POST",
"httpParams": "{\"user\": {\"email\": \"${user.email}\",\"first_name\": \"${user.firstname}\", \"last_name\": \"${user.lastname}\" , \"role\": \"${entitlementValue.entitlementID}\"}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [204, 200, 201]
}
}]
}
04/04/2023 10:33 PM
Hello @IAM_99,
As @Darshanjain Mentioned in the Forum Post , You were using this in creating account json and the binding variables ${entitlementValue.*} is only exposed in add access json. Here the system is calling the create account as the account is not present hence it is throwing an error.