REST-API-Endpunkte für Project (classic)-Projektmitarbeiter
Verwende die REST-API, um Projektmitarbeiter für ein Projekt (klassisch) zu verwalten.
Note
Projects (classic) wurde entfernt. Weitere Informationen zu dieser Änderung finden Sie im Blog the GitHub Blog.
Die neue und verbesserte Projekterfahrung ist jetzt verfügbar. Weitere Informationen findest du unter Informationen zu Projects.
Diese Endpunkte interagieren nur mit projects (classic). Verwende zum Verwalten von Projects die GraphQL-API. Weitere Informationen findest du unter Verwalten von Projects mit der API.
Die REST-API zum Verwalten von projects (classic) unterstützt ausschließlich die Authentifizierung mit einem personal access token (classic). Weitere Informationen findest du unter Verwalten deiner persönlichen Zugriffstoken.
List project collaborators
Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project admin
to list collaborators.
Differenzierte Zugriffstoken für "List project collaborators"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss mindestens einen der folgenden Berechtigungssätze aufweisen.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameter für „List project collaborators“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
project_id integer ErforderlichThe unique identifier of the project. |
Name, type, BESCHREIBUNG |
---|
affiliation string Filters the collaborators by their affiliation. Standard: Kann eine der Folgenden sein: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
HTTP-Antwortstatuscodes für „List project collaborators“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „List project collaborators“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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
Adds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project admin
to add a collaborator.
Differenzierte Zugriffstoken für "Add project collaborator"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss mindestens einen der folgenden Berechtigungssätze aufweisen.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameter für „Add project collaborator“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
project_id integer ErforderlichThe unique identifier of the project. |
username string ErforderlichThe handle for the GitHub user account. |
Name, type, BESCHREIBUNG |
---|
permission string The permission to grant the collaborator. Standard: Kann eine der Folgenden sein: |
HTTP-Antwortstatuscodes für „Add project collaborator“
Statuscode | BESCHREIBUNG |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Add project collaborator“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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
Removes a collaborator from an organization project. You must be an organization owner or a project admin
to remove a collaborator.
Differenzierte Zugriffstoken für "Remove user as a collaborator"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss mindestens einen der folgenden Berechtigungssätze aufweisen.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameter für „Remove user as a collaborator“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
project_id integer ErforderlichThe unique identifier of the project. |
username string ErforderlichThe handle for the GitHub user account. |
HTTP-Antwortstatuscodes für „Remove user as a collaborator“
Statuscode | BESCHREIBUNG |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Remove user as a collaborator“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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
Returns the collaborator's permission level for an organization project. Possible values for the permission
key: admin
, write
, read
, none
. You must be an organization owner or a project admin
to review a user's permission level.
Differenzierte Zugriffstoken für "Get project permission for a user"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss mindestens einen der folgenden Berechtigungssätze aufweisen.:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameter für „Get project permission for a user“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
project_id integer ErforderlichThe unique identifier of the project. |
username string ErforderlichThe handle for the GitHub user account. |
HTTP-Antwortstatuscodes für „Get project permission for a user“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Codebeispiele für „Get project permission for a user“
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Anforderungsbeispiel
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
}
}