How to add group and role to a project using Hub REST API
I'm trying to add a group to a project and give the group a specific role so any member of that group have the correct permissions. It's not clear to me exactly which Hub API endpoint I should use (I think I should use the “Add Project Role to Project Roles of a User Group” endpoint - <REST API URL>/usergroups/{user group id}/projectroles?fields=string). If that is correct then it's not clear what I need to add as the payload for the POST call. I've tried using the following
{"role": "role_id",
"project": "project_ring_id",
"owner": "user_group_id"
}
but I get the following error message: Cannot construct instance of `jetbrains.jetpass.rest.dto.RoleJSON` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('role_id')\n at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 4, column: 1] (through reference chain: jetbrains.jetpass.rest.dto.ProjectRoleJSON[\"role\"]
If I get project_roles for the project (and overall) then the role_id I am using is the one that is used consistently in all projects. Please can someone let me know what I'm doing wrong here.
Thanks. Nick.
Please sign in to leave a comment.
OK - I've worked this out for myself. The payload needs the following structure:
{"role":{"id": "role_id"},
"project":{"id": "project_id"}
}
Hi Nick,
Thank you for sharing your solution! We appreciate that!