Skip to main content

此版本的 GitHub Enterprise Server 已于以下日期停止服务 2024-03-26. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

站点管理员将企业服务器实例升级为 Enterprise Server 3.9 或更高版本后,REST API 将进行版本控制。 若要了解如何查找实例的版本,请参阅“关于 GitHub Docs 的版本”。 有关详细信息,请参阅“关于 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”的参数

标头
名称, 类型, 说明
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>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/security-managers

Response

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", "permission": "admin", "members_url": "https://HOSTNAME/teams/1/members{/member}", "repositories_url": "https://HOSTNAME/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”的参数

标头
名称, 类型, 说明
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>" \ http(s)://HOSTNAME/api/v3/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”的参数

标头
名称, 类型, 说明
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>" \ http(s)://HOSTNAME/api/v3/orgs/ORG/security-managers/teams/TEAM_SLUG

Response

Status: 204