Points de terminaison d’API REST pour les collaborateurs Project (classic)
Remarque
Projects (classic) has been retired. Vous pouvez en savoir plus sur cette modification sur the Blog.
La nouvelle expérience Projets améliorée est disponible. Pour plus d’informations, consultez « À propos des Projects ».
Ces points de terminaison interagissent uniquement avec projects (classic). Pour gérer des Projects, utilisez l’API GraphQL. Pour plus d’informations, consultez « Utilisation de l’API pour gérer des Projects ».
Remarque
L’API REST permettant de gérer des projects (classic) prend uniquement en charge l’authentification à l’aide d’un personal access token (classic). Pour plus d’informations, consultez « Gestion de vos jetons d'accès personnels ».
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Jetons d’accès affinés pour « List project collaborators »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application
- Jetons d’accès d’installation d’application
- Jetons d’accès personnel affiné
Le jeton précis doit avoir au moins l’un des ensembles d’autorisations suivants:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Paramètres pour « List project collaborators »
Nom, Type, Description |
---|
accept stringSetting to |
Nom, Type, Description |
---|
project_id integer ObligatoireThe unique identifier of the project. |
Nom, Type, Description |
---|
affiliation stringFilters the collaborators by their affiliation. Default: Peut être: |
per_page integerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
Codes d’état de la réponse HTTP pour « List project collaborators »
Code d’état | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « List project collaborators »
Exemple de requête
curl -L \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators
Response
Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..com/users/octocat/received_events", "type": "User", "site_admin": false } ]
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Jetons d’accès affinés pour « Add project collaborator »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application
- Jetons d’accès d’installation d’application
- Jetons d’accès personnel affiné
Le jeton précis doit avoir au moins l’un des ensembles d’autorisations suivants:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Paramètres pour « Add project collaborator »
Nom, Type, Description |
---|
accept stringSetting to |
Nom, Type, Description |
---|
project_id integer ObligatoireThe unique identifier of the project. |
username string ObligatoireThe handle for the user account. |
Nom, Type, Description |
---|
permission stringThe permission to grant the collaborator. Default: Peut être: |
Codes d’état de la réponse HTTP pour « Add project collaborator »
Code d’état | Description |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « Add project collaborator »
Exemple de requête
curl -L \ -X PUT \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators/USERNAME \ -d '{"permission":"write"}'
Response
Status: 204
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Jetons d’accès affinés pour « Remove user as a collaborator »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application
- Jetons d’accès d’installation d’application
- Jetons d’accès personnel affiné
Le jeton précis doit avoir au moins l’un des ensembles d’autorisations suivants:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Paramètres pour « Remove user as a collaborator »
Nom, Type, Description |
---|
accept stringSetting to |
Nom, Type, Description |
---|
project_id integer ObligatoireThe unique identifier of the project. |
username string ObligatoireThe handle for the user account. |
Codes d’état de la réponse HTTP pour « Remove user as a collaborator »
Code d’état | Description |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « Remove user as a collaborator »
Exemple de requête
curl -L \ -X DELETE \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators/USERNAME
Response
Status: 204
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Jetons d’accès affinés pour « Get project permission for a user »
Ce point de terminaison fonctionne avec les types de jetons précis suivants:
- Jetons d’accès utilisateur d’application
- Jetons d’accès d’installation d’application
- Jetons d’accès personnel affiné
Le jeton précis doit avoir au moins l’un des ensembles d’autorisations suivants:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Paramètres pour « Get project permission for a user »
Nom, Type, Description |
---|
accept stringSetting to |
Nom, Type, Description |
---|
project_id integer ObligatoireThe unique identifier of the project. |
username string ObligatoireThe handle for the user account. |
Codes d’état de la réponse HTTP pour « Get project permission for a user »
Code d’état | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « Get project permission for a user »
Exemple de requête
curl -L \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators/USERNAME/permission
Response
Status: 200
{ "permission": "admin", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..com/users/octocat/received_events", "type": "User", "site_admin": false } }