Developer Portal for YouTrack and Hub Help

Groups of a Specific User

This resource provides access to the groups where a specific user belongs.

Resource

<Hub Service URL>/api/rest/users/{userID}/groups

Returned entity

UserGroup. For the description of the entity attributes, see User Attributes.

Supported methods

Group Attributes

Represents a group in Hub and YouTrack.

Attributes

This table describes attributes of the UserGroup 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 group. Read-only.

aliases

Set.<alias>

The set of IDs of groups that have been merged into this group.

allUsers

Boolean

true if this is the All Users group. This is a special unique group that always includes all user accounts in the system.

autoJoin

Boolean

Determines whether new users are added to this group automatically.

autoJoinDomain

String

Stores an optional email domain used for auto-joining users to this group. If the user's email belongs to this domain, they are added to this group automatically.

description

String

The description of the group.

iconUrl

String

The URL of the icon of the group.

name

String

The name of the group.

organizations

Set.<organization>

The list of organizations that this group belongs to.

ownUsers

Set.<user>

The list of users that belong to this group directly.

parent

userGroup

The parent group that this group belongs to.

project

Set.<project>

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

projectRoles

Set.<projectRole>

The list of project roles assigned to the users of this group.

subgroups

Set.<userGroup>

The list of groups that belong to this group as sub-groups.

userCount

Integer

The number of users that belong to the group.

users

Set.<user>

The list of all users that belong to this group.

Read a List of Groups of the User

Get all groups that the user belongs to.

Request Syntax

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

Request Parameters

Parameter

Type

Description

fields

String

Optional. Returns only the specified subset of the fields for each user. 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 Users 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 UserGroup fields and tuples, see Hub REST API Reference.

orderBy

String

Optional Returns the list of Users sorted by a specified field. See Sorting Syntax for details. Groups support ordering by the following fields: name.

Sample

Request

https://example.youtrack.cloud/hub/api/rest/users/{userID}/groups?fields=

Response Body

{ "type": "GroupsPage", "skip": 0, "top": 100, "total": 64, "groups": [ { "type": "userGroup", "id": "73c0b3a8-94f3-4930-b0a0-060f1fbb2577", "name": "Developers" }, { "type": "userGroup", "id": "f424d1bf-f4fe-4ac5-b64a-48d980805849", "name": "Registered Users" }, { "type": "userGroup", "id": "e62c7d12-72be-47aa-97cd-04e58ee8af95_team", "name": "Monitoring Team", "projectRoles": [ { "type": "projectRole", "id": "51548dca-f9f0-41f2-9713-c1196f8e65a1", "role": { "id": "5f90c1f3-689b-427c-b726-a303e477b4b6", "key": "developer", "name": "Developer", "immutable": false }, "project": { "id": "af40774d-1b45-486d-9e61-d30397b5d474" }, "owner": { "type": "userGroup", "id": "e62c7d12-86be-47aa-95cd-04e58ee8af95_team" } } ] } ] }

Add a User to a Group

Add a specific user to a group.

Required fields: id.

Request Syntax

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

Request Parameters

Parameter

Type

Description

fields

String

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

Sample

In this example, we add a user to a group with the specified id.

Request

https://example.youtrack.cloud/hub/api/rest/users/358f7edd-57a6-482a-b0ca-5255af60097a/groups?fields=id,name

Request Body

{ "id": "9d2d19df-745d-4bc0-84fe-675d79e8c49a" }

Response Body

{ "type": "userGroup", "id": "9d2d19df-745d-4bc0-84fe-675d79e8c49a", "name": "Monitoring Team" }
Last modified: 11 June 2024