CreateGroupMember - Add group members

Updated at:

Adds one or more members to a code group. Supports adding individual users or entire teams.

Applicable editions

Central edition, Region edition

Service endpoint and authorization

  • Obtain a service endpoint to replace the {domain} placeholder in the request syntax.
  • Obtain a personal access token.
  • Obtain the organization ID. This is required only for the Central edition. Go to the organization settings page and find the organization ID on the basic information page.

Product

Resource

Required permissions

Codeup

member

Read and write

Request syntax

Central edition

POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/groups/{groupId}/members

Region edition

POST https://{domain}/oapi/v1/codeup/groups/{groupId}/members

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

The personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

In

Required

Description

Example value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

The organization ID.

60d54f3daccf2bbd6659f3ad

groupId

string

path

Yes

The group ID or the URL-encoded full path of the group.

2813489 or 60de7a6852743a5162b5f957%2FDemoGroup

accessLevel

integer

query

Yes

The access level to grant. Valid values: 20 (Reporter), 30 (Developer), and 40 (Maintainer).

30

userId

string

query

No

The Alibaba Cloud DevOps user ID. To add multiple users, specify a comma-separated list of IDs.

62c795xxxb468af8

teamId

string

query

No

The team ID. To add multiple teams, specify a comma-separated list of IDs.

600294b0-xxxx-xxxx-xxxx-2a26cbce1e05

expiresAt

string

query

No

The membership's expiration date in YYYY-MM-DD format. If unspecified or null, the membership never expires.

2024-10-05

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/groups/2813489/members?accessLevel=30&userId=62c795xxxb468af8&teamId=600294b0-xxxx-xxxx-xxxx-2a26cbce1e05&expiresAt=2024-10-05' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/groups/2813489/members?accessLevel=30&userId=62c795xxxb468af8&teamId=600294b0-xxxx-xxxx-xxxx-2a26cbce1e05&expiresAt=2024-10-05' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response parameters

Parameter

Type

Description

Example value

-

array

An array of objects, each representing a newly added member.

-

object

accessLevel

integer

The access level of the member. Valid values: 20 (Reporter), 30 (Developer), and 40 (Maintainer).

30

avatarUrl

string

The URL of the avatar.

https://example/example/w/100/h/100

expiresAt

string

The expiration time of the membership.

2024-10-05T15:30:45Z

id

integer

The unique ID of the membership record, with no business significance.

2813489

inheritedGroup

object

The group from which permissions are inherited. Null if the member is added directly to the current group.

avatarUrl

string

The URL of the avatar.

https://example/example/w/100/h/100

fullPath

string

The full path of the group.

60de7a6852743a5162b5f957/parent-group

id

integer

The ID of the group.

1

kind

string

The resource type. The value is group.

group

name

string

The name of the group.

ParentGroup

nameWithNamespace

string

The full name of the group, including the namespace.

60de7a6852743a5162b5f957 / ParentGroup

parentId

integer

The ID of the parent group.

2

path

string

The path of the group.

parent-group

pathWithNamespace

string

The full path of the group, including the namespace.

60de7a6852743a5162b5f957/parent-group

visibility

string

The group's visibility level. This can be empty in inheritance scenarios. Valid values: private, internal, or public.

private

webUrl

string

The URL of the group's web page.

https://example.com/60de7a6852743a5162b5f957/parent-group

memberType

string

The member type. Valid values: USERS (for an individual user) or TEAMS (for a team).

USERS

name

string

The name of the member.

codeup-demo

state

string

The member state. Valid values: active (normal access) and blocked (temporarily unable to access the group).

active

teamId

string

The team ID. Null for individual user members.

70d8ddd4-xxxx-xxxx-xxxx-46100efe985e

userId

string

The Alibaba Cloud DevOps user ID, used across all Codeup API operations.

62c795xxxb468af8

username

string

The username of the member.

codeup-username

webUrl

string

The URL to the member's profile page.

xxx

Response example

[
    {
        "accessLevel": 30,
        "avatarUrl": "https://example/example/w/100/h/100",
        "expiresAt": "2024-10-05T15:30:45Z",
        "id": 2813489,
        "inheritedGroup": {
            "avatarUrl": "https://example/example/w/100/h/100",
            "fullPath": "60de7a6852743a5162b5f957/parent-group",
            "id": 1,
            "kind": "group",
            "name": "ParentGroup",
            "nameWithNamespace": "60de7a6852743a5162b5f957 / ParentGroup",
            "parentId": 2,
            "path": "parent-group",
            "pathWithNamespace": "60de7a6852743a5162b5f957/parent-group",
            "visibility": "private",
            "webUrl": "https://example.com/60de7a6852743a5162b5f957/parent-group"
        },
        "memberType": "USERS",
        "name": "codeup-demo",
        "state": "active",
        "teamId": "70d8ddd4-xxxx-xxxx-xxxx-46100efe985e",
        "userId": "62c795xxxb468af8",
        "username": "codeup-username",
        "webUrl": "xxx"
    }
]

Error codes

For error codes, see the Error Code Center.