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

REST Connection - java.lang.IllegalArgumentException: Illegal character in path at index 62:

mayankshah
New Contributor III
New Contributor III

Hi Team,

| Error java.lang.IllegalArgumentException: Illegal character in path at index 62: http://xxxxxxxxxxx.xxx.com/maxrest/rest/os/xxxxxxx/${for(Map map:response.Groups1.message.rdfs:member[0].spi:groupuser){if(map.spi:groupname.toString().equals(entitlementValue.entitlement_value)){return map.spi:groupuserid;}}}

I am getting above error while passsing below JSON in remove access:

{
"call": [
{
"name": "Groups",
"connection": "acctAuth",
"url": "http://xxxxxxxxxxxxxxxxxx.xxx.com/maxrest/oslc/os/xxxxxxxx?oslc.select=maxuserid,userid,status,group...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "Groups",
"connection": "acctAuth",
"url": "http://xxxxxxxxxxx.xxx.com/maxrest/rest/os/xxxxxxxxxx/${for(Map map:response.Groups1.message.rdfs:member[0].spi:groupuser){if(map.spi:groupname.toString().equals(entitlementValue.entitlement_value)){return map.spi:groupuserid;}}}",
"httpMethod": "DELETE",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}

 

Note: I tried hardcoding and found that there is parsing isssue in ${for(Map map:response.Groups1.message.rdfs:member[0].spi:groupuser){if(map.spi:groupname.toString().equals(entitlementValue.entitlement_value)){return map.spi:groupuserid;}}}

Harcoding like below works:

http://xxxxxxxxxxx.xxx.com/maxrest/rest/os/xxxxxxxxxx/123456

Thanks

 

 

4 REPLIES 4

RakeshMG
Saviynt Employee
Saviynt Employee

Please try following RemoveAccessJSON
------------------------
{
"call": [
{
"name": "Group",
"connection": "acctAuth",
"url": "@HOSTNAME@/api/v2/users/${account.accountID}/group_memberships",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "Group",
"connection": "acctAuth",
"url": "@HOSTNAME@/api/v2/group_memberships/${for (Map map : response.Group1.message.group_memberships){if (map.group_id.toString().equals(entitlementValue.entitlementID)){return map.id;}}}",
"httpMethod": "DELETE",
"httpParams": "{\"user\": {\"TEST\": ${requestAccessAttributes.TEST}}}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
204
]
}
}
]
}


​Regards

Rakesh M Goudar

mayankshah
New Contributor III
New Contributor III

Attaching the remove access JSON reponse from logs.

The issue that I see is of parsing the URI:

"url": "http://xxxxxx.com/maxrest/rest/os/xxxx/${response.Groups1.message.rdfs:member[0].spi:groupuserid}"

mayankshah_0-1676009882990.png

 

RakeshMG
Saviynt Employee
Saviynt Employee

In your url you are using groupname and entitlement_value. Please try using group_id and entitlementID

Like:

{for (Map map : response.Group1.message.group_memberships){if (map.group_id.toString().equals(entitlementValue.entitlementID)){return map.id;}}}


​Regards

Rakesh M Goudar

mayankshah
New Contributor III
New Contributor III

Solution that worked for me.

 

{
"call": [
{
"name": "Groups",
"connection": "acctAuth",
"showResponse": true,
"url": "http://xxxxxx?oslc.where=userid=%22${account.name}%22and%20groupname=%22${entitlementValue.entitleme...",
"httpMethod": "GET",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
},
{
"name": "Groups",
"connection": "acctAuth",
"showResponse": true,
"url": "http://xxxxxx/${String jsonData = new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(response.Groups1.message); return new org.json.JSONObject(jsonData).getJSONArray(\"rdfs:member\").getJSONObject(0).getInt(\"spi:groupuserid\")}",
"httpMethod": "DELETE",
"httpParams": "",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201
]
}
}
]
}