API for Assigning Role and Project to Group
I am trying to assign role and project to a group. But couldn't find any API for that.
Is there any API available?
Is there any URL I can use and write my own code to achieve what I want?
Please sign in to leave a comment.
Hi,
yes, there is an API available for this. Our REST API documentation doesn't provide the full overview of what's available, but you can check the /app/rest/swagger.json for a full, detailed list of the endpoints we provide. In particular, for your scenario, the /app/rest/userGroups/{groupLocator}/roles accepts the GET, POST and PUT messages, so it should be possible to add roles to user groups there.
Thank you @Denis!
I was able to solve this few days back.
Hi Denis,
Thank you for swagger documentation. It helps.
I need roleId to associate role to a group, but I did not find APIs to list all available roles even in swagger documentation.
I see, we can get roles for a group or user but not standard roles created in the teamcity. What are the way to list all roles using REST API?
I'm afraid there is currently no endpoint to list the full set of roles available on the server. We have a feature request for it here, which includes a possible workaround in the comments: https://youtrack.jetbrains.com/issue/TW-37581
Please watch and vote for it.
Another workaround could be to have a dummy user that simply holds all the roles and you can list their roles for it.