Skip to main content

Enterprise Server 3.15 est actuellement disponible en tant que version finale (RC).

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 rôles de l’organisation

Utilisez l'API REST pour interagir avec les rôles d'organisation.

List organization fine-grained permissions for an organization

Lists the fine-grained permissions that can be used in custom organization roles for an organization. For more information, see "Managing people's access to your organization with roles."

To list the fine-grained permissions that can be used in custom repository roles for an organization, see "List repository fine-grained permissions for an organization."

To use this endpoint, the authenticated user must be one of:

  • An administrator for the organization.
  • A user, or a user on a team, with the fine-grained permissions of read_organization_custom_org_role in the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « List organization fine-grained permissions for an organization »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Custom organization roles" organization permissions (read)

Paramètres pour « List organization fine-grained permissions 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 « List organization fine-grained permissions for an organization »

Code d’étatDescription
200

OK

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemples de code pour « List organization fine-grained permissions for an organization »

Exemple de requête

get/orgs/{org}/organization-fine-grained-permissions
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-fine-grained-permissions

Response

Status: 200
[ { "name": "read_organization_custom_org_role", "description": "View organization roles" }, { "name": "write_organization_custom_org_role", "description": "Manage custom organization roles" } ]

Get all organization roles for an organization

Lists the organization roles available in this organization. For more information on organization roles, see "Using organization roles."

To use this endpoint, the authenticated user must be one of:

  • An administrator for the organization.
  • A user, or a user on a team, with the fine-grained permissions of read_organization_custom_org_role in the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Get all organization roles for an organization »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Custom organization roles" organization permissions (read)

Paramètres pour « Get all organization roles 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 all organization roles for an organization »

Code d’étatDescription
200

Response - list of organization roles

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemples de code pour « Get all organization roles for an organization »

Exemple de requête

get/orgs/{org}/organization-roles
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles

Response - list of organization roles

Status: 200
{ "total_count": 2, "roles": [ { "id": 8030, "name": "Custom Role Manager", "description": "Permissions to manage custom roles within an org", "permissions": [ "write_organization_custom_repo_role", "write_organization_custom_org_role", "read_organization_custom_repo_role", "read_organization_custom_org_role" ], "organization": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/github", "html_url": "https://github.com/github", "followers_url": "https://HOSTNAME/users/github/followers", "following_url": "https://HOSTNAME/users/github/following{/other_user}", "gists_url": "https://HOSTNAME/users/github/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/github/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/github/subscriptions", "organizations_url": "https://HOSTNAME/users/github/orgs", "repos_url": "https://HOSTNAME/users/github/repos", "events_url": "https://HOSTNAME/users/github/events{/privacy}", "received_events_url": "https://HOSTNAME/users/github/received_events", "type": "Organization", "site_admin": false }, "created_at": "2022-07-04T22:19:11Z", "updated_at": "2022-07-04T22:20:11Z" }, { "id": 8031, "name": "Auditor", "description": "Permissions to read the organization audit log", "permissions": [ "read_audit_logs" ], "organization": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://HOSTNAME/users/github", "html_url": "https://github.com/github", "followers_url": "https://HOSTNAME/users/github/followers", "following_url": "https://HOSTNAME/users/github/following{/other_user}", "gists_url": "https://HOSTNAME/users/github/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/github/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/github/subscriptions", "organizations_url": "https://HOSTNAME/users/github/orgs", "repos_url": "https://HOSTNAME/users/github/repos", "events_url": "https://HOSTNAME/users/github/events{/privacy}", "received_events_url": "https://HOSTNAME/users/github/received_events", "type": "Organization", "site_admin": false }, "created_at": "2022-07-04T22:19:11Z", "updated_at": "2022-07-04T22:20:11Z" } ] }

Create a custom organization role

Creates a custom organization role that can be assigned to users and teams, granting them specific permissions over the organization and optionally across all repositories in the organization. For more information on custom organization roles, see "Managing people's access to your organization with roles."

To include repository permissions in an organization role, you must also include the base_role field, which is one of read, write, triage, maintain, or admin (or none if no base role is set). This base role provides a set of fine-grained permissions as well as implicit permissions - those that aren't exposed as fine-grained permissions and can only be granted through the base role (like "reading a repo"). If you include repository permissions, those permissions apply across all of the repositories in the organization. You do not have to include organization permissions in order to add repository permissions.

See "List repository permissions" for valid repository permissions.

To use this endpoint, the authenticated user must be one of:

  • An administrator for the organization.
  • A user, or a user on a team, with the fine-grained permissions of write_organization_custom_org_role in the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Create a custom organization role »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Custom organization roles" organization permissions (write)

Paramètres pour « Create a custom organization role »

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
name string Obligatoire

The name of the custom role.

description string

A short description about the intended usage of this role or what permissions it grants.

permissions array of strings Obligatoire

A list of additional permissions included in this role.

base_role string

The system role from which this role can inherit permissions.

Peut être: read, triage, write, maintain, admin

Codes d’état de la réponse HTTP pour « Create a custom organization role »

Code d’étatDescription
201

Created

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

Exemples de code pour « Create a custom organization role »

Exemple de requête

post/orgs/{org}/organization-roles
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles \ -d '{"name":"Custom Role Manager","description":"Permissions to manage custom roles within an org","permissions":["write_organization_custom_repo_role","write_organization_custom_org_role","read_organization_custom_repo_role","read_organization_custom_org_role"]}'

Response

Status: 201
{ "id": 8030, "name": "Custom Role Manager", "description": "Permissions to manage custom roles within an org", "permissions": [ "write_organization_custom_repo_role", "write_organization_custom_org_role", "read_organization_custom_repo_role", "read_organization_custom_org_role" ], "organization": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://HOSTNAME/orgs/github", "repos_url": "https://HOSTNAME/orgs/github/repos", "events_url": "https://HOSTNAME/orgs/github/events", "hooks_url": "https://HOSTNAME/orgs/github/hooks", "issues_url": "https://HOSTNAME/orgs/github/issues", "members_url": "https://HOSTNAME/orgs/github/members{/member}", "public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }, "created_at": "2022-07-04T22:19:11Z", "updated_at": "2022-07-04T22:19:11Z" }

Remove all organization roles for a team

Removes all assigned organization roles from a team. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Remove all organization roles for a team »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (write)

Paramètres pour « Remove all organization roles for a team »

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.

team_slug string Obligatoire

The slug of the team name.

Codes d’état de la réponse HTTP pour « Remove all organization roles for a team »

Code d’étatDescription
204

No Content

Exemples de code pour « Remove all organization roles for a team »

Exemple de requête

delete/orgs/{org}/organization-roles/teams/{team_slug}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/teams/TEAM_SLUG

Response

Status: 204

Assign an organization role to a team

Assigns an organization role to a team in an organization. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Assign an organization role to a team »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (write)

Paramètres pour « Assign an organization role to a team »

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.

team_slug string Obligatoire

The slug of the team name.

role_id integer Obligatoire

The unique identifier of the role.

Codes d’état de la réponse HTTP pour « Assign an organization role to a team »

Code d’étatDescription
204

No Content

404

Response if the organization, team or role does not exist.

422

Response if the organization roles feature is not enabled for the organization, or validation failed.

Exemples de code pour « Assign an organization role to a team »

Exemple de requête

put/orgs/{org}/organization-roles/teams/{team_slug}/{role_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/teams/TEAM_SLUG/ROLE_ID

Response

Status: 204

Remove an organization role from a team

Removes an organization role from a team. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Remove an organization role from a team »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (write)

Paramètres pour « Remove an organization role from a team »

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.

team_slug string Obligatoire

The slug of the team name.

role_id integer Obligatoire

The unique identifier of the role.

Codes d’état de la réponse HTTP pour « Remove an organization role from a team »

Code d’étatDescription
204

No Content

Exemples de code pour « Remove an organization role from a team »

Exemple de requête

delete/orgs/{org}/organization-roles/teams/{team_slug}/{role_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/teams/TEAM_SLUG/ROLE_ID

Response

Status: 204

Remove all organization roles for a user

Revokes all assigned organization roles from a user. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Remove all organization roles for a user »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (write)

Paramètres pour « Remove all organization roles for a user »

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.

username string Obligatoire

The handle for the GitHub user account.

Codes d’état de la réponse HTTP pour « Remove all organization roles for a user »

Code d’étatDescription
204

No Content

Exemples de code pour « Remove all organization roles for a user »

Exemple de requête

delete/orgs/{org}/organization-roles/users/{username}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/users/USERNAME

Response

Status: 204

Assign an organization role to a user

Assigns an organization role to a member of an organization. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Assign an organization role to a user »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (write)

Paramètres pour « Assign an organization role to a user »

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.

username string Obligatoire

The handle for the GitHub user account.

role_id integer Obligatoire

The unique identifier of the role.

Codes d’état de la réponse HTTP pour « Assign an organization role to a user »

Code d’étatDescription
204

No Content

404

Response if the organization, user or role does not exist.

422

Response if the organization roles feature is not enabled enabled for the organization, the validation failed, or the user is not an organization member.

Exemples de code pour « Assign an organization role to a user »

Exemple de requête

put/orgs/{org}/organization-roles/users/{username}/{role_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/users/USERNAME/ROLE_ID

Response

Status: 204

Remove an organization role from a user

Remove an organization role from a user. For more information on organization roles, see "Using organization roles."

The authenticated user must be an administrator for the organization to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Remove an organization role from a user »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (write)

Paramètres pour « Remove an organization role from a user »

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.

username string Obligatoire

The handle for the GitHub user account.

role_id integer Obligatoire

The unique identifier of the role.

Codes d’état de la réponse HTTP pour « Remove an organization role from a user »

Code d’étatDescription
204

No Content

Exemples de code pour « Remove an organization role from a user »

Exemple de requête

delete/orgs/{org}/organization-roles/users/{username}/{role_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/users/USERNAME/ROLE_ID

Response

Status: 204

Get an organization role

Gets an organization role that is available to this organization. For more information on organization roles, see "Using organization roles."

To use this endpoint, the authenticated user must be one of:

  • An administrator for the organization.
  • A user, or a user on a team, with the fine-grained permissions of read_organization_custom_org_role in the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Get an organization role »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Custom organization roles" organization permissions (read)

Paramètres pour « Get an organization role »

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.

role_id integer Obligatoire

The unique identifier of the role.

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

Code d’étatDescription
200

OK

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemples de code pour « Get an organization role »

Exemple de requête

get/orgs/{org}/organization-roles/{role_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/ROLE_ID

Response

Status: 200
{ "id": 8030, "name": "Custom Role Manager", "description": "Permissions to manage custom roles within an org", "permissions": [ "write_organization_custom_repo_role", "write_organization_custom_org_role", "read_organization_custom_repo_role", "read_organization_custom_org_role" ], "organization": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://HOSTNAME/orgs/github", "repos_url": "https://HOSTNAME/orgs/github/repos", "events_url": "https://HOSTNAME/orgs/github/events", "hooks_url": "https://HOSTNAME/orgs/github/hooks", "issues_url": "https://HOSTNAME/orgs/github/issues", "members_url": "https://HOSTNAME/orgs/github/members{/member}", "public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }, "created_at": "2022-07-04T22:19:11Z", "updated_at": "2022-07-04T22:20:11Z" }

Update a custom organization role

Updates an existing custom organization role. Permission changes will apply to all assignees. For more information on custom organization roles, see "Managing people's access to your organization with roles."

If the update would add repository permissions, the base_role must also be set to a value besides none, either previously or as part of the update. If the update sets the base_role field to none, you must also remove all of the repository permissions as well, otherwise the update will fail.

To use this endpoint, the authenticated user must be one of:

  • An administrator for the organization.
  • A user, or a user on a team, with the fine-grained permissions of write_organization_custom_org_role in the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Update a custom organization role »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Custom organization roles" organization permissions (write)

Paramètres pour « Update a custom organization role »

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.

role_id integer Obligatoire

The unique identifier of the role.

Paramètres du corps
Nom, Type, Description
name string

The name of the custom role.

description string

A short description about the intended use of this role or the permissions it grants.

permissions array of strings

A list of additional permissions included in this role.

base_role string

The system role from which this role can inherit permissions.

Peut être: none, read, triage, write, maintain, admin

Codes d’état de la réponse HTTP pour « Update a custom organization role »

Code d’étatDescription
200

OK

404

Resource not found

409

Conflict

422

Validation failed, or the endpoint has been spammed.

Exemples de code pour « Update a custom organization role »

Exemple de requête

patch/orgs/{org}/organization-roles/{role_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/ROLE_ID \ -d '{"description":"Permissions to manage custom roles within an org."}'

Response

Status: 200
{ "id": 8030, "name": "Custom Role Manager", "description": "Permissions to manage custom roles within an org", "permissions": [ "write_organization_custom_repo_role", "write_organization_custom_org_role", "read_organization_custom_repo_role", "read_organization_custom_org_role" ], "organization": { "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://HOSTNAME/orgs/github", "repos_url": "https://HOSTNAME/orgs/github/repos", "events_url": "https://HOSTNAME/orgs/github/events", "hooks_url": "https://HOSTNAME/orgs/github/hooks", "issues_url": "https://HOSTNAME/orgs/github/issues", "members_url": "https://HOSTNAME/orgs/github/members{/member}", "public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }, "created_at": "2022-07-04T22:19:11Z", "updated_at": "2022-07-04T22:19:11Z" }

Delete a custom organization role.

Deletes a custom organization role. For more information on custom organization roles, see "Managing people's access to your organization with roles."

To use this endpoint, the authenticated user must be one of:

  • An administrator for the organization.
  • A user, or a user on a team, with the fine-grained permissions of write_organization_custom_org_role in the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « Delete a custom organization role. »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Custom organization roles" organization permissions (write)

Paramètres pour « Delete a custom organization role. »

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.

role_id integer Obligatoire

The unique identifier of the role.

Codes d’état de la réponse HTTP pour « Delete a custom organization role. »

Code d’étatDescription
204

No Content

Exemples de code pour « Delete a custom organization role. »

Exemple de requête

delete/orgs/{org}/organization-roles/{role_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/ROLE_ID

Response

Status: 204

List teams that are assigned to an organization role

Lists the teams that are assigned to an organization role. For more information on organization roles, see "Using organization roles."

To use this endpoint, you must be an administrator for the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « List teams that are assigned to an organization role »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (read)

Paramètres pour « List teams that are assigned to an organization role »

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.

role_id integer Obligatoire

The unique identifier of the role.

Paramètres de requête
Nom, Type, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Default: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Default: 1

Codes d’état de la réponse HTTP pour « List teams that are assigned to an organization role »

Code d’étatDescription
200

Response - List of assigned teams

404

Response if the organization or role does not exist.

422

Response if the organization roles feature is not enabled or validation failed.

Exemples de code pour « List teams that are assigned to an organization role »

Exemple de requête

get/orgs/{org}/organization-roles/{role_id}/teams
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/ROLE_ID/teams

Response - List of assigned teams

Status: 200
[ { "id": 1, "node_id": "MDQ6VGVhbTE=", "url": "https://HOSTNAME/teams/1", "html_url": "https://github.com/orgs/github/teams/justice-league", "name": "Justice League", "slug": "justice-league", "description": "A great team.", "privacy": "closed", "notification_setting": "notifications_enabled", "permission": "admin", "members_url": "https://HOSTNAME/teams/1/members{/member}", "repositories_url": "https://HOSTNAME/teams/1/repos", "parent": null } ]

List users that are assigned to an organization role

Lists organization members that are assigned to an organization role. For more information on organization roles, see "Using organization roles."

To use this endpoint, you must be an administrator for the organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

Jetons d’accès affinés pour « List users that are assigned to an organization role »

Ce point de terminaison fonctionne avec les types de jetons précis suivants:

Le jeton précis doit avoir l’ensemble d’autorisations suivant:

  • "Members" organization permissions (read)

Paramètres pour « List users that are assigned to an organization role »

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.

role_id integer Obligatoire

The unique identifier of the role.

Paramètres de requête
Nom, Type, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Default: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Default: 1

Codes d’état de la réponse HTTP pour « List users that are assigned to an organization role »

Code d’étatDescription
200

Response - List of assigned users

404

Response if the organization or role does not exist.

422

Response if the organization roles feature is not enabled or validation failed.

Exemples de code pour « List users that are assigned to an organization role »

Exemple de requête

get/orgs/{org}/organization-roles/{role_id}/users
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ http(s)://HOSTNAME/api/v3/orgs/ORG/organization-roles/ROLE_ID/users

Response - List of assigned users

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://HOSTNAME/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://HOSTNAME/users/octocat/followers", "following_url": "https://HOSTNAME/users/octocat/following{/other_user}", "gists_url": "https://HOSTNAME/users/octocat/gists{/gist_id}", "starred_url": "https://HOSTNAME/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://HOSTNAME/users/octocat/subscriptions", "organizations_url": "https://HOSTNAME/users/octocat/orgs", "repos_url": "https://HOSTNAME/users/octocat/repos", "events_url": "https://HOSTNAME/users/octocat/events{/privacy}", "received_events_url": "https://HOSTNAME/users/octocat/received_events", "type": "User", "site_admin": false } ]