Member¶
The member (collaborator) endpoints manage repository-level collaborators and permissions. With the API you can list repository members, add a member or change their permissions, remove a member, and query the permission points of a member or of yourself within a repository.
Organization members and enterprise members have their own groups; this group covers repository collaborators only.
Objects¶
| Object | Description | Related endpoints |
|---|---|---|
| Member | List of repository collaborators | Get all members of a repository |
| Member permission | Permission level of an individual member in a repository | View repository member permissions |
| Self-service query | Permissions of the current token in a repository | Get the current member's permissions |
Identification¶
- A repository is identified by
owner+repo, and a member byusername. - Self-service queries use the fixed segment
self-permissionand do not requireusername.
Common tasks¶
| Task | Endpoint |
|---|---|
| List repository members | GET /api/v5/repos/{owner}/{repo}/collaborators |
| Add a member or update permissions | PUT /api/v5/repos/{owner}/{repo}/collaborators/{username} |
| Remove a member | DELETE /api/v5/repos/{owner}/{repo}/collaborators/{username} |
| Check whether a user is a repository member | GET /api/v5/repos/{owner}/{repo}/collaborators/{username} |
| View a member's permissions | GET /api/v5/repos/{owner}/{repo}/collaborators/{username}/permission |
| View your own permissions | GET /api/v5/repos/{owner}/{repo}/collaborators/self-permission |
Notes¶
- Adding a member and changing permissions are the same
PUT; calling it again overwrites the permission, so you do not need to remove the member and add it again. - Checking membership and querying member details share
GET …/collaborators/{username}; permission points are under its/permissionsubpath. self-permissionis a fixed literal path segment; do not replace it with a user name literal.- Repository-level roles and custom roles live in the repository group (
…/members/{username},…/customized_roles) and are not interchangeable with thecollaboratorspaths in this group.
Endpoint list¶
This module contains 6 endpoints.
| # | Endpoint | Method and path | Description |
|---|---|---|---|
| 1 | Add a repository member or update a member's permissions | PUT /api/v5/repos/{owner}/{repo}/collaborators/{username} |
This endpoint adds a repository member or updates a member's permissions: if the target user is not yet a repository member, the user is added as a member; if the target user is already a repository member, their permiss… |
| 2 | Remove a repository member | DELETE /api/v5/repos/{owner}/{repo}/collaborators/{username} |
This endpoint removes the specified member (collaborator) from the specified repository. It locates the collaborator by user name and removes that member from the repository. |
| 3 | Check whether a user is a repository member | GET /api/v5/repos/{owner}/{repo}/collaborators/{username} |
This endpoint checks whether the specified user is a member of the specified repository, using the namespace address of the repository, the repository path, and the user name; if the user is a repository member it ret… |
| 4 | Get all members of a repository | GET /api/v5/repos/{owner}/{repo}/collaborators |
This endpoint retrieves all members of the specified repository and supports pagination by page number and page size. The response includes the members' basic profile (such as member ID, login name… |
| 5 | View a repository member's permissions | GET /api/v5/repos/{owner}/{repo}/collaborators/{username}/permission |
This endpoint queries the permission information of a member in the specified repository, including the member's basic profile, permission level (admin/write/read), and permission det… |
| 6 | View permission points of the current member's repository | GET /api/v5/repos/{owner}/{repo}/collaborators/self-permission |
This endpoint queries the role and permission points of the current member in the specified repository, returning role information and a permission matrix tree that shows the specific operations the member can perform on resources such as project, code, and memb… |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc