and more in a single search tool across platforms. Read the announcement here. |
06/13/2024 04:03 AM
For one of the application, we are using REST based connector. We are able to create, update, disable, enable account as well as import account and groups. However, we are not able to grant user access to groups via ADD ACCESS JSON. Update date and time of add access task is changed but there is no error as such being captured. However, the API call is wokring from Postman.
Sharing the JSON as well as Postman body and URL for your reference:
POSTMAN:
Endpoint URL:
1. (PUT) https://abc/userroles/userID
2. (PUT) https://abc/userdcs/userID
Response:
ADD ACCESS JSON:
{
"call": [
{
"name": "groups",
"connection": "acctAuth",
"url": "https://abc/userroles/${user.username}",
"httpMethod": "PUT",
"httpParams": "[\"${entitlementValue.entitlement_value}\"]",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
},
{
"name": "dcs",
"connection": "acctAuth",
"url": "https://abc/userdcs/${user.username}",
"httpMethod": "PUT",
"httpParams": "[\"${entitlementValue.entitlement_value}\"]",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
}
]
}
Solved! Go to Solution.
06/13/2024 04:29 AM
Hi @shruanand24
Your API expects only list of roles to be added in the request payload? Is there any error in logs? Can you request and response in the logs?
Can you try below and check once.
{
"call": [
{
"name": "groups",
"connection": "acctAuth",
"url": "https://abc/userroles/${user.username}",
"httpMethod": "PUT",
"httpParams": "{[\"${entitlementValue.entitlement_value}\"]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
},
{
"name": "dcs",
"connection": "acctAuth",
"url": "https://abc/userdcs/${user.username}",
"httpMethod": "PUT",
"httpParams": "{[\"${entitlementValue.entitlement_value}\"]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
}
]
}
06/13/2024 04:52 AM
hi @pmahalle I tried the payload you shared but no luck. And yes the API only expect roles names to be mentioned in the request body. Also, sharing the logs for your reference.
06/13/2024 06:42 AM
Does call name and entitlement type name matching?
06/13/2024 07:28 AM - edited 06/13/2024 07:28 AM
I updated the call name to the entitlement type name, atleast I see error getting printed now. I am using below JSON:
{
"call": [
{
"name": "Security Role",
"connection": "acctAuth",
"url": "https://abc/userroles/${user.username}",
"httpMethod": "PUT",
"httpParams": "{\"${entitlementValue.entitlement_value}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
},
{
"name": "Location",
"connection": "acctAuth",
"url": "https://abc/userdcs/${user.username}",
"httpMethod": "PUT",
"httpParams": "{\"${entitlementValue.entitlement_value}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
}
]
}
and this is the error:
"Security Role":{"message":"Unexpected character ('}' (code 125)): was expecting a colon to separate field name and value\n at [Source: {\"Wire Cutter_NA\"}; line: 1, column: 19]","status":"Failed"}}
06/13/2024 07:32 AM
Seems like URL is wrong, you copies https twice. Try below
{
"call": [
{
"name": "Security Role",
"connection": "acctAuth",
"url": "https://azlwmxbolt01d.wescodist.com/wmx/rest/security/userroles/${user.username}",
"httpMethod": "PUT",
"httpParams": "[\"${entitlementValue.entitlement_value}\"]",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
},
{
"name": "Location",
"connection": "acctAuth",
"url": "https://azlwmxbolt01d.wescodist.com/wmx/rest/security/userdcs/${user.username}",
"httpMethod": "PUT",
"httpParams": "[\"${entitlementValue.entitlement_value}\"]",
"httpHeaders": {
"Authorization": "${access_token}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204
]
},
"unsuccessResponses": {
"statusCode": [
400,
403,
401,
409,
501,
500,
404
]
}
}
]
}
06/13/2024 08:02 AM
This worked, thank you!