CreateRepositoryMember - Add repository members
Adds one or more users or teams as members of a code repository.
|
Applicable editions |
Central edition, Region edition |
Service endpoint and authorization
- Find your service endpoint: Replace
{domain}in the request URL with your endpoint. - Obtain a personal access token.
- Find your organization ID on the Basic Information page in the organization admin console. Required only for the Central edition.
|
Product |
Resource |
Required permission |
|
Code Management |
Members |
Read/Write |
Request syntax
Central edition
POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/members
Region edition
POST https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/members
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
The personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example |
|
organizationId |
string |
path |
|
The organization ID. |
60d54f3daccf2bbd6659f3ad |
|
repositoryId |
string |
path |
Yes |
The repository ID, or the URL-encoded full path of the repository. |
2813489 or 60de7a6852743a5162b5f957%2FDemoRepo |
|
accessLevel |
integer |
query |
Yes |
The access level. Valid values: 20 (Viewer), 30 (Developer), and 40 (repository administrator). |
40 |
|
userId |
string |
query |
No |
The Alibaba Cloud DevOps user ID. Separate multiple IDs with commas (,). |
df43d71d-528f-411d-8837-eaa56b2c421a,df43d71d-528f-411d-8837-eaa56b2c421b |
|
teamId |
string |
query |
No |
The team ID. Separate multiple IDs with commas (,). |
70d8ddd4-xxxx-xxxx-xxxx-46100efe985e,600294b0-xxxx-xxxx-xxxx-2a26cbce1e05 |
|
expiresAt |
string |
query |
No |
The expiration date of the member's access, in |
2024-10-05 |
Request examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489/members?accessLevel=40&userId=df43d71d-528f-411d-8837-eaa56b2c421a,df43d71d-528f-411d-8837-eaa56b2c421b&teamId=70d8ddd4-xxxx-xxxx-xxxx-46100efe985e,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/repositories/2813489/members?accessLevel=40&userId=df43d71d-528f-411d-8837-eaa56b2c421a,df43d71d-528f-411d-8837-eaa56b2c421b&teamId=70d8ddd4-xxxx-xxxx-xxxx-46100efe985e,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 |
| - |
array |
The list of repository members. |
|
| - |
object |
A repository member object. |
|
| accessLevel |
integer |
The member's access level. Valid values: 20 (Viewer), 30 (Developer), and 40 (repository administrator). |
30 |
| avatarUrl |
string |
The avatar URL. |
https://example/example/w/100/h/100 |
| expiresAt |
string |
The expiration time of the member's access. |
2024-10-05T15:30:45Z |
| id |
integer |
The auto-generated primary key ID. This ID has no business significance. |
2813489 |
| inheritedGroup |
object |
The group from which permissions are inherited. Null if the member was added directly to the repository. |
|
| avatarUrl |
string |
The avatar URL. |
https://example/example/w/100/h/100 |
| fullPath |
string |
The full path of the namespace. |
60de7a6852743a5162b5f957/parent-group |
| id |
integer |
The ID. |
1 |
| kind |
string |
The type. Typically |
group |
| name |
string |
The name. |
ParentGroup |
| nameWithNamespace |
string |
The full name, including the namespace. |
60de7a6852743a5162b5f957 / ParentGroup |
| parentId |
integer |
The ID of the parent path. |
2 |
| path |
string |
The path. |
parent-group |
| pathWithNamespace |
string |
The full path, including the namespace. |
60de7a6852743a5162b5f957/parent-group |
| visibility |
string |
The visibility level. Can be null in inheritance scenarios. Valid values: |
private |
| webUrl |
string |
The page URL. |
https://example.com/60de7a6852743a5162b5f957/parent-group |
| memberType |
string |
The member type. |
USERS |
| name |
string |
The member name. |
codeup-demo |
| state |
string |
The member state. Valid values: |
active |
| teamId |
string |
The team ID. Null for individual users. |
70d8ddd4-xxxx-xxxx-xxxx-46100efe985e |
| userId |
string |
The Alibaba Cloud DevOps user ID. |
62c795xxxb468af8 |
| username |
string |
The username. |
codeup-username |
| webUrl |
string |
The member's profile page URL. |
https://example.com/users/codeup-username |
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": "https://example.com/users/codeup-username"
}
]
Error codes
For possible error codes, see the Error Code Center.