Skip to content

Latest commit

 

History

History
123 lines (93 loc) · 4.3 KB

member_roles.md

File metadata and controls

123 lines (93 loc) · 4.3 KB
stage group info
Manage
Authentication and Authorization
To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments

Member roles API (ULTIMATE)

List all member roles of a group

Gets a list of group member roles viewable by the authenticated user.

GET /groups/:id/member_roles
Attribute Type Required Description
id integer/string yes The ID or URL-encoded path of the group owned by the authenticated user

If successful, returns 200 and the following response attributes:

Attribute Type Description
[].id integer The ID of the member role.
[].group_id integer The ID of the group that the member role belongs to.
[].base_access_level integer Base access level for member role.
[].read_code boolean Permission to read code.
[].read_dependency boolean Permission to read project dependencies.

Example request:

curl --header "Authorization: Bearer <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/member_roles"

Example response:

[
  {
    "id": 2,
    "group_id": 84,
    "base_access_level": 10,
    "read_code": true
  },
  {
    "id": 3,
    "group_id": 84,
    "base_access_level": 10,
    "read_code": false
  }
]

Add a member role to a group

Adds a member role to a group.

POST /groups/:id/member_roles

To add a member role to a group, the group must be at root-level (have no parent group).

Attribute Type Required Description
id integer/string yes The ID or URL-encoded path of the group owned by the authenticated user.
base_access_level integer yes Base access level for configured role.
read_code boolean no Permission to read code.
read_dependency boolean no Permission to read project dependencies.

If successful, returns 201 and the following attributes:

Attribute Type Description
id integer The ID of the member role.
group_id integer The ID of the group that the member role belongs to.
base_access_level integer Base access level for member role.
read_code boolean Permission to read code.
read_dependency boolean Permission to read project dependencies.

Example request:

 curl --request POST --header "Content-Type: application/json" --header "Authorization: Bearer $YOUR_ACCESS_TOKEN" --data '{"base_access_level" : 10, "read_code" : true}' "https://example.gitlab.com/api/v4/groups/:id/member_roles"

Example response:

{
  "id": 3,
  "group_id": 84,
  "base_access_level": 10,
  "read_code": true,
  "read_dependency": false
}

Remove member role of a group

Deletes a member role of a group.

DELETE /groups/:id/member_roles/:member_role_id
Attribute Type Required Description
id integer/string yes The ID or URL-encoded path of the group owned by the authenticated user.
member_role_id integer yes The ID of the member role.

If successful, returns 204 and an empty response.

Example request:

curl --request DELETE --header "Content-Type: application/json" --header "Authorization: Bearer $YOUR_ACCESS_TOKEN" "https://example.gitlab.com/api/v4/groups/:group_id/member_roles/:member_role_id"