Getting an error when adding permissions to a role in UI and using API

We tried to add trace and deploy permissions for a custom role but received the following error both in the UI and the mgmt api call:

{
"code": "security.UnableToAddMultipleResourcePermission",
"message": "Unable to add multiple resource permissions for Role Custom",
"contexts": []
}
0 1 284
1 REPLY 1

The user was trying to add permissions to multiple resources for a role using the Add Permissions for Resource to a Role management API as shown below:

curl --location --request POST 'https://api.enterprise.apigee.com/v1/organizations/<org-name>/userroles/Custom/permissions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {{{ADMINUSER}}}' \
--data-raw '{
"resourcePermission": [
{
"path": "/applications/TestAPIProxy",
"permissions": [
"get",
"delete",
"put"
]
},
{
"path": "/environments/dev/applications/TestAPIProxy/revisions/*/deployments",
"permissions": [
"delete",
"put"
]
},
{
"path": "/environments/test/applications/TestAPIProxy/revisions/*/deployments",
"permissions": [
"delete",
"put"
]
},
{
"path": "/environments/dev/applications/TestAPIProxy/revisions/*/debugsessions",
"permissions": [
"get",
"put"
]
},
{
"path": "/environments/test/applications/TestAPIProxy/*/debugsessions",
"permissions": [

"get",
"put"
]
}
]
}'

The right way to add permissions to multiple resources is to use Add Multiple Resource Permissions for Resource management API.