Конечные точки REST API для участников совместной работы Project (classic)
Используйте REST API для управления участниками совместной работы на project (классическая модель).
Note
Projects (classic) удален. Дополнительные сведения об этом изменении можно узнать о the GitHub Blog.
Доступен новый и улучшенный интерфейс проектов. Дополнительные сведения см. в разделе Сведения о Projects.
Эти конечные точки взаимодействуют только с данными projects (classic). Для управления данными Projectsиспользуйте API GraphQL. Дополнительные сведения см. в разделе Использование API для управления Projects.
Note
REST API для управления projects (classic) поддерживает проверку подлинности только с помощью personal access token (classic). Дополнительные сведения см. в разделе Управление личными маркерами доступа.
List project collaborators
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Подробные маркеры доступа для "List project collaborators
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь по крайней мере один из следующих наборов разрешений.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Параметры для "List project collaborators"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
project_id integer Обязательное полеThe unique identifier of the project. |
Имя., Тип, Description |
---|
affiliation string Filters the collaborators by their affiliation. По умолчанию.: Возможные значения: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." По умолчанию.: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." По умолчанию.: |
Коды состояния http-ответа для "List project collaborators"
Код состояния | Описание |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Примеры кода для "List project collaborators"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com
выделенный поддомен api.SUBDOMAIN.ghe.com
предприятия.
Пример запроса
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/projects/PROJECT_ID/collaborators
Response
Status: 200
[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]
Add project collaborator
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Подробные маркеры доступа для "Add project collaborator
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь по крайней мере один из следующих наборов разрешений.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Параметры для "Add project collaborator"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
project_id integer Обязательное полеThe unique identifier of the project. |
username string Обязательное полеThe handle for the GitHub user account. |
Имя., Тип, Description |
---|
permission string The permission to grant the collaborator. По умолчанию.: Возможные значения: |
Коды состояния http-ответа для "Add project collaborator"
Код состояния | Описание |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Примеры кода для "Add project collaborator"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com
выделенный поддомен api.SUBDOMAIN.ghe.com
предприятия.
Пример запроса
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/projects/PROJECT_ID/collaborators/USERNAME \
-d '{"permission":"write"}'
Response
Status: 204
Remove user as a collaborator
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Подробные маркеры доступа для "Remove user as a collaborator
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь по крайней мере один из следующих наборов разрешений.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Параметры для "Remove user as a collaborator"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
project_id integer Обязательное полеThe unique identifier of the project. |
username string Обязательное полеThe handle for the GitHub user account. |
Коды состояния http-ответа для "Remove user as a collaborator"
Код состояния | Описание |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Примеры кода для "Remove user as a collaborator"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com
выделенный поддомен api.SUBDOMAIN.ghe.com
предприятия.
Пример запроса
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/projects/PROJECT_ID/collaborators/USERNAME
Response
Status: 204
Get project permission for a user
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Подробные маркеры доступа для "Get project permission for a user
Эта конечная точка работает со следующими точными типами маркеров:
- Маркеры доступа пользователей приложения GitHub
- Маркеры доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь по крайней мере один из следующих наборов разрешений.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Параметры для "Get project permission for a user"
Имя., Тип, Description |
---|
accept string Setting to |
Имя., Тип, Description |
---|
project_id integer Обязательное полеThe unique identifier of the project. |
username string Обязательное полеThe handle for the GitHub user account. |
Коды состояния http-ответа для "Get project permission for a user"
Код состояния | Описание |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Примеры кода для "Get project permission for a user"
Если вы обращаетесь к GitHub в GHE.com, замените api.github.com
выделенный поддомен api.SUBDOMAIN.ghe.com
предприятия.
Пример запроса
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/projects/PROJECT_ID/collaborators/USERNAME/permission
Response
Status: 200
{
"permission": "admin",
"user": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
}