Skip to main content
REST API 现已经过版本控制。 有关详细信息,请参阅“关于 API 版本控制”。

适用于安全管理器的 REST API 终结点

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

关于安全管理器

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

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

警告:从团队中删除安全管理员角色将删除团队在整个组织中管理安全警报和设置的能力,但团队将保留对分配角色时授予的存储库读取访问权限。 您必须手动删除任何不需要的读取访问权限。 有关详细信息,请参阅“管理团队对组织仓库的访问”。

List security manager teams

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

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

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

“List security manager teams”的细粒度访问令牌

此终结点适用于以下令牌类型:

令牌必须具有以下权限集:

  • organization_administration:read

“List security manager teams”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
org string 必须

The organization name. The name is not case sensitive.

“List security manager teams”的 HTTP 响应状态代码

状态代码说明
200

OK

“List security manager teams”的示例代码

请求示例

get/orgs/{org}/security-managers
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/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", "notification_setting": "notifications_enabled", "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

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

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

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

“Add a security manager team”的细粒度访问令牌

此终结点适用于以下令牌类型:

令牌必须具有以下权限集:

  • organization_administration:write

“Add a security manager team”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
org string 必须

The organization name. The name is not case sensitive.

team_slug string 必须

The slug of the team name.

“Add a security manager team”的 HTTP 响应状态代码

状态代码说明
204

No Content

409

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

“Add a security manager team”的示例代码

请求示例

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

Response

Status: 204

Remove a security manager team

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."

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.

“Remove a security manager team”的细粒度访问令牌

此终结点适用于以下令牌类型:

令牌必须具有以下权限集:

  • organization_administration:write

“Remove a security manager team”的参数

标头
名称, 类型, 说明
accept string

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

路径参数
名称, 类型, 说明
org string 必须

The organization name. The name is not case sensitive.

team_slug string 必须

The slug of the team name.

“Remove a security manager team”的 HTTP 响应状态代码

状态代码说明
204

No Content

“Remove a security manager team”的示例代码

请求示例

delete/orgs/{org}/security-managers/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" \ https://api.github.com/orgs/ORG/security-managers/teams/TEAM_SLUG

Response

Status: 204