Developer Portal for YouTrack and Hub Help

Project Roles of a Specific Group

This resource provides access to the roles of a specific user that they have for a specific project.

Resource

<Hub Service URL>/api/rest/usergroups/{groupID}/projectroles

Returned entity

ProjectRole. For the description of the entity attributes, see ProjectRole Attributes.

Supported methods

ProjectRole Attributes

Represents a role that is granted to all group members on a specific project.

Attributes

This table describes attributes of the ProjectRole entity.

  • To receive an attribute in the response from the server, specify it explicitly in the fields request parameter.

  • To update an attribute, provide it in the body of a POST request.

Field

Type

Description

id

String

The unique identifier of the project role. Read-only.

owner

Set.<authorityHolder>

The list of users and groups that this project role is granted to.

project

Set.<project>

The list of projects in which the role is used as a resource.

role

Set.<role>

The role that the user has in the project.

Read a List of Project Roles of a User

Get all project roles of a group that match the specified query.

Request Syntax

GET <Hub Service URL>/api/rest/users/{userID}/projectroles?{fields}&{$top}&{$skip}&{query}&{orderBy}

Request Parameters

Parameter

Type

Description

fields

String

Optional. Returns only the specified subset of the fields for each ProjectRole. Use Fields Syntax to define the subset.

$skip

Int

Optional. Lets you set a number of returned entities to skip before returning the first one.

$top

Int

Optional. Lets you specify the maximum number of ProjectRoles that are returned in the response.

query

String

Optional. Lets you specify a search query to filter the returned results. See Query Syntax for the definition of supported logical operations syntax. For the ProjectRole fields and tuples, see Hub REST API Reference.

orderBy

String

Optional Returns the list of ProjectRoles sorted by a specified field. See Sorting Syntax for details. ProjectRoles support ordering by the following fields: project, role.

Sample

Request

https://example.youtrack.cloud/hub/api/rest/usergroups/358f6edd-57a6-482a-b0ca-5255af60097a/projectroles?fields=id,role(name),project(name)

Response Body

{ "type": "ProjectrolesPage", "skip": 0, "top": 100, "total": 20, "projectroles": [ { "type": "projectRole", "id": "f34aff29-9162-414a-a1a3-12219ebfbbb9", "role": { "name": "System Admin", "immutable": false }, "project": { "name": "Global" } }, { "type": "projectRole", "id": "571ea3d6-1f2d-4313-a951-dfb0c2887299", "role": { "name": "Project Admin", "immutable": false }, "project": { "name": "Model Engineering" } }, { "type": "projectRole", "id": "5252f3da-ee32-451d-b2e3-694e641455be", "role": { "name": "Contributor", "immutable": false }, "project": { "name": "Helpdesk" } } ] }

Add a New Project Role to the Group

Add a new project role to the group.

Required fields: id of the project, id of the role.

Request Syntax

POST <Hub Service URL>/api/rest/usergroups/{userID}/projectroles?fields=string

Request Parameters

Parameter

Type

Description

fields

String

A list of ProjectRole attributes that should be returned in the response. If no field is specified, only the entityID is returned.

Sample

In this example, we add the Contributor role for the Model Engineering project to a group.

Request

https://example.youtrack.cloud/hub/api/rest/usergroups/c408bf43-ab05-476f-9b36-a9fe0cad45c9/projectroles?fields=id,role(name),project(name)

Request Body

{ "role": { "id": "5f50c1f3-679b-427c-b726-a303e477b4b6", "name": "Contributor" }, "project": { "id": "2bc5869e-1203-4fd2-8aae-5a04038a3870", "name": "Model Engineering" } }

Response Body

{ "type": "projectRole", "id": "bc1dff58-463a-4d74-b765-dbba4ecb3234", "role": { "name": "Contributor", "immutable": false }, "project": { "name": "Model Engineering" } }
Last modified: 19 June 2024