Skip to main content
The REST API is now versioned. For more information, see "About API versioning."

安全经理

使用 REST API 管理组织中的安全管理器。

关于安全管理器

注意:安全经理角色处于公开测试阶段,可能会发生更改。

安全经理是组织级别的角色,组织所有者可以将其分配给组织中的任何团队。 应用后,该角色会授予团队中的每个成员管理整个组织的安全警报和设置的权限,以及对组织中所有存储库的读取权限。

List security manager teams

Works with GitHub Apps

Lists teams that are security managers for an organization. For more information, see "Managing security managers in your organization."

To use this endpoint, you must be an administrator or security manager for the organization, and you must use an access token with the read:org scope.

GitHub Apps must have the administration organization read permission to use this endpoint.

Parameters

Headers
名称, Type, 说明
acceptstring

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

Path parameters
名称, Type, 说明
orgstringRequired

The organization name. The name is not case sensitive.

HTTP response status codes

Status code说明
200

OK

Code samples

get/orgs/{org}/security-managers
curl \ -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/security-managers

Response

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

Add a security manager team

Works with GitHub Apps

Adds a team as a security manager for an organization. For more information, see "Managing security for an organization for an organization."

To use this endpoint, you must be an administrator for the organization, and you must use an access token with the write:org scope.

GitHub Apps must have the administration organization read-write permission to use this endpoint.

Parameters

Headers
名称, Type, 说明
acceptstring

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

Path parameters
名称, Type, 说明
orgstringRequired

The organization name. The name is not case sensitive.

team_slugstringRequired

The slug of the team name.

HTTP response status codes

Status code说明
204

No Content

409

The organization has reached the maximum number of security manager teams.

Code samples

put/orgs/{org}/security-managers/teams/{team_slug}
curl \ -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/security-managers/teams/TEAM_SLUG

Response

Status: 204

Remove a security manager team

Works with GitHub Apps

Removes the security manager role from a team for an organization. For more information, see "Managing security managers in your organization team from an organization."

To use this endpoint, you must be an administrator for the organization, and you must use an access token with the admin:org scope.

GitHub Apps must have the administration organization read-write permission to use this endpoint.

Parameters

Headers
名称, Type, 说明
acceptstring

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

Path parameters
名称, Type, 说明
orgstringRequired

The organization name. The name is not case sensitive.

team_slugstringRequired

The slug of the team name.

HTTP response status codes

Status code说明
204

No Content

Code samples

delete/orgs/{org}/security-managers/teams/{team_slug}
curl \ -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/security-managers/teams/TEAM_SLUG

Response

Status: 204