The Wayback Machine - https://web.archive.org/web/20220831130124/https://docs.github.com/cn/rest/orgs/custom-roles
Skip to main content

自定义存储库角色

List custom repository roles in an organization

List the custom repository roles available in this organization. In order to see custom repository roles in an organization, the authenticated user must be an organization owner.

To use this endpoint the authenticated user must be an administrator for the organization or of an repository of the organizaiton and must use an access token with admin:org repo scope. GitHub Apps must have the organization_custom_roles:read organization permission to use this endpoint.

For more information on custom repository roles, see "Managing custom repository roles for an organization".

参数

标头
名称, 类型, 描述
acceptstring

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

路径参数
名称, 类型, 描述
organization_idstring必选

The unique identifier of the organization.

HTTP 响应状态代码

状态代码描述
200

Response - list of custom role names

代码示例

get/organizations/{organization_id}/custom_roles
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://api.github.com/organizations/ORGANIZATION_ID/custom_roles

Response - list of custom role names

Status: 200
{ "total_count": 2, "custom_roles": [ { "id": 8030, "name": "Developer" }, { "id": 8031, "name": "Designer" } ] }