Skip to main content
REST API はバージョン管理になりました。 詳細については、「API のバージョン管理について」を参照してください。

組織の相互作用用の REST API エンドポイント

REST API を使って、組織のパブリック リポジトリ内でコメントする、イシューを開く、または pull request を作成することができるユーザーの種類を一時的に制限します。

組織の相互作用について

組織の所有者は、組織のパブリック リポジトリ内でコメントする、イシューを開く、または pull request を作成することができるユーザーの種類を一時的に制限できます。 制限が有効化されると、指定した種類のGitHubユーザのみがインタラクションに参加できるようになります。 制限は、定義された期間の後に自動的に期限切れになります。 GitHub ユーザのタイプについては以下を参照してください。

  • OrganizationのExisting users(既存のユーザー): インタラクションを existing_users に制限すると、24 時間以下しか経過していないアカウントの新規ユーザーで、以前にコントリビューションしておらず、コラボレーターでもないユーザーは、一時的に制限されます。
  • OrganizationのContributors only (共同作成者のみ): 対話を contributors_only に制限すると、以前に投稿していない共同作成者ではないユーザーは一時的に制限されます
  • OrganizationのCollaborators only(コラボレーターのみ): インタラクションを collaborators_only に制限すると、コラボレーターではないユーザーは一時的に制限されます

Organizationレベルでインタラクション制限を設定すると、Organizationが所有する個々のリポジトリに設定されているインタラクション制限は上書きされます。 Organization が所有する個々のリポジトリに対して異なるインタラクション制限を設定するには、代わりにリポジトリ インタラクション エンドポイントを使ってください。

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.

"Get interaction restrictions for an organization" のきめ細かいアクセス トークン

このエンドポイントは、次のトークンの種類で動作します:

トークンには次のアクセス許可が設定されている必要があります:

  • organization_administration:read

"Get interaction restrictions for an organization" のパラメーター

ヘッダー
名前, Type, 説明
accept string

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

パス パラメーター
名前, Type, 説明
org string 必須

The organization name. The name is not case sensitive.

"Get interaction restrictions for an organization" の HTTP 応答状態コード

状態コード説明
200

OK

"Get interaction restrictions for an organization" のコード サンプル

要求の例

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.

"Set interaction restrictions for an organization" のきめ細かいアクセス トークン

このエンドポイントは、次のトークンの種類で動作します:

トークンには次のアクセス許可が設定されている必要があります:

  • organization_administration:write

"Set interaction restrictions for an organization" のパラメーター

ヘッダー
名前, Type, 説明
accept string

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

パス パラメーター
名前, Type, 説明
org string 必須

The organization name. The name is not case sensitive.

本文のパラメーター
名前, Type, 説明
limit string 必須

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

次のいずれかにできます: existing_users, contributors_only, collaborators_only

expiry string

The duration of the interaction restriction. Default: one_day.

次のいずれかにできます: one_day, three_days, one_week, one_month, six_months

"Set interaction restrictions for an organization" の HTTP 応答状態コード

状態コード説明
200

OK

422

Validation failed, or the endpoint has been spammed.

"Set interaction restrictions for an organization" のコード サンプル

要求の例

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.

"Remove interaction restrictions for an organization" のきめ細かいアクセス トークン

このエンドポイントは、次のトークンの種類で動作します:

トークンには次のアクセス許可が設定されている必要があります:

  • organization_administration:write

"Remove interaction restrictions for an organization" のパラメーター

ヘッダー
名前, Type, 説明
accept string

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

パス パラメーター
名前, Type, 説明
org string 必須

The organization name. The name is not case sensitive.

"Remove interaction restrictions for an organization" の HTTP 応答状態コード

状態コード説明
204

No Content

"Remove interaction restrictions for an organization" のコード サンプル

要求の例

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