Hello. I am unable to add a project role to a filter via Jira REST API with the following:
POST /rest/api/2/filter/{filterID}/permission
{
"type": "project_role",
"projectId": 10003,
"projectRoleId" : 10002,
"view": true,
"edit": false
}
The API return with the following error:
{
"errorMessages": [
"Invalid type given. Should be one of [PROJECT, GROUP, PROJECT_ROLE, GLOBAL, AUTHENTICATED, USER]"
],
"errors": {}
}
I've tried both upper and lower case "project_role" with no avail. Is this an issue with my JSON format or a Jira bug? I've tried this on v7.12.3 and v7.13.1. Thanks.
Hi Ed,
You are going to want to set the type to projectRole and the projectId for the project that the role is in and use projectRoleId for the id of the role like the following exe and it should do the trick:
{
"type":"projectRole",
"projectId":"10003",
"projectRoleId":"10002"
}
A full exe curl would look like this:
curl -D- -u user:pass -X POST --data '{"type":"projectRole","projectId":"10003","projectRoleId":"10002"}' -H "Content-Type: application/json" "http://BASE_URL/rest/api/2/filter/{filterID}/permission"
I'm sure you probably already have the following but just adding this in for referance incase anyone comes across this post, additional details on the endpoint can be seen at the following link:
Regards,
Earl
Ahhh, "type":"projectRole"! So this looks like a minor bug in previous versions (and potentially latest as well). Notice the error message said PROJECT_ROLE, and documentation is lacking around the valid types.
{
"errorMessages": [
"Invalid type given. Should be one of [PROJECT, GROUP, PROJECT_ROLE, GLOBAL, AUTHENTICATED, USER]"
],
"errors": {}
}
Also, for anyone else looking for this, it MUST be projectRole in camel casing.
Regardless, thanks!
Ed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ed,
Good catch I totally missed that, and yeah that would be a bug for the error output and that should read with the appropriate value, I created a bug report to track this here:
Regards,
Earl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.