Skip to main content
L’API REST est maintenant versionnée. Pour plus d’informations, consultez « À propos des versions de l’API ».

Points de terminaison d’API REST pour les interactions de l’organisation

Utilisez l’API REST pour restreindre temporairement le type d’utilisateur qui peut commenter, ouvrir des problèmes ou créer des demandes de tirage sur les référentiels publics de l’organisation.

À propos des interactions d’organisation

Les propriétaires d’organisation peuvent restreindre temporairement le type d’utilisateur qui peut commenter, ouvrir des problèmes ou créer des demandes de tirage sur les référentiels publics de l’organisation. Lorsque des restrictions sont activées, seul le type spécifié d’utilisateur GitHub pourra participer aux interactions. Les restrictions expirent automatiquement après une durée définie. Voici plus d’informations sur les types d’utilisateurs GitHub :

  • Utilisateurs existants : Lorsque vous limitez les interactions aux existing_users, les nouveaux utilisateurs avec des comptes de moins de 24 heures qui n’ont pas déjà contribué et qui ne sont pas collaborateurs seront temporairement limités. dans l’organisation.
  • Contributeurs uniquement : Lorsque vous limitez les interactions aux contributors_only, les utilisateurs qui n’ont pas déjà contribué et qui ne sont pas collaborateurs sont temporairement limités. dans l’organisation.
  • Collaborateurs uniquement : lorsque vous limitez les interactions en choisissant collaborators_only, les utilisateurs qui ne sont pas des collaborateurs sont temporairement limités dans l’organisation.

La définition de la limite d’interaction au niveau de l’organisation remplace toutes les limites d’interaction définies pour les référentiels individuels appartenant à l’organisation. Pour définir des limites d’interaction différentes pour les référentiels individuels appartenant à l’organisation, utilisez plutôt des points de terminaison d’interaction de référentiel.

Get interaction restrictions for an organization

Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response.

Jetons d’accès affinés pour « Get interaction restrictions for an organization »

Ce point de terminaison fonctionne avec les types de jetons suivants:

Le jeton doit avoir l’ensemble d’autorisations suivant:

  • organization_administration:read

Paramètres pour « Get interaction restrictions for an organization »

En-têtes
Nom, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Paramètres de chemin d’accès
Nom, Type, Description
org string Obligatoire

The organization name. The name is not case sensitive.

Codes d’état de la réponse HTTP pour « Get interaction restrictions for an organization »

Code d’étatDescription
200

OK

Exemples de code pour « Get interaction restrictions for an organization »

Exemple de requête

get/orgs/{org}/interaction-limits
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/orgs/ORG/interaction-limits

Response

Status: 200
{ "limit": "collaborators_only", "origin": "organization", "expires_at": "2018-08-17T04:18:39Z" }

Set interaction restrictions for an organization

Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization.

Jetons d’accès affinés pour « Set interaction restrictions for an organization »

Ce point de terminaison fonctionne avec les types de jetons suivants:

Le jeton doit avoir l’ensemble d’autorisations suivant:

  • organization_administration:write

Paramètres pour « Set interaction restrictions for an organization »

En-têtes
Nom, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Paramètres de chemin d’accès
Nom, Type, Description
org string Obligatoire

The organization name. The name is not case sensitive.

Paramètres du corps
Nom, Type, Description
limit string Obligatoire

The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect.

Peut être: existing_users, contributors_only, collaborators_only

expiry string

The duration of the interaction restriction. Default: one_day.

Peut être: one_day, three_days, one_week, one_month, six_months

Codes d’état de la réponse HTTP pour « Set interaction restrictions for an organization »

Code d’étatDescription
200

OK

422

Validation failed, or the endpoint has been spammed.

Exemples de code pour « Set interaction restrictions for an organization »

Exemple de requête

put/orgs/{org}/interaction-limits
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/orgs/ORG/interaction-limits \ -d '{"limit":"collaborators_only","expiry":"one_month"}'

Response

Status: 200
{ "limit": "collaborators_only", "origin": "organization", "expires_at": "2018-08-17T04:18:39Z" }

Remove interaction restrictions for an organization

Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions.

Jetons d’accès affinés pour « Remove interaction restrictions for an organization »

Ce point de terminaison fonctionne avec les types de jetons suivants:

Le jeton doit avoir l’ensemble d’autorisations suivant:

  • organization_administration:write

Paramètres pour « Remove interaction restrictions for an organization »

En-têtes
Nom, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Paramètres de chemin d’accès
Nom, Type, Description
org string Obligatoire

The organization name. The name is not case sensitive.

Codes d’état de la réponse HTTP pour « Remove interaction restrictions for an organization »

Code d’étatDescription
204

No Content

Exemples de code pour « Remove interaction restrictions for an organization »

Exemple de requête

delete/orgs/{org}/interaction-limits
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/orgs/ORG/interaction-limits

Response

Status: 204