用于企业访问验证的 REST API 终结点
使用 REST API 在 GitHub 企业版中管理企业访问验证配置。
Disable access restrictions for an enterprise
Disable access restriction by proxy header using the network proxy owned by the enterprise.
“Disable access restrictions for an enterprise”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Disable access restrictions for an enterprise”的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
enterprise string 必须The slug version of the enterprise name. |
“Disable access restrictions for an enterprise”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
200 | OK |
400 | Forbidden |
404 | Resource not found |
500 | Internal Error |
“Disable access restrictions for an enterprise”的示例代码
如果你通过 GHE.com 访问 GitHub,请将 api.github.com 替换为你的企业在 api.SUBDOMAIN.ghe.com 上的专用子域。
请求示例
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/access-restrictions/disableResponse
Status: 200{
"message": "Enterprise access restrictions successfully disabled.",
"header_name": "sec-GitHub-allowed-enterprise",
"header_value": "12345"
}Enable access restrictions for an enterprise
Enable access restriction by proxy header using the network proxy owned by the enterprise.
“Enable access restrictions for an enterprise”的细粒度访问令牌
此终结点不适用于 GitHub 应用程序用户访问令牌、GitHub 应用程序安装访问令牌或细粒度个人访问令牌。
“Enable access restrictions for an enterprise”的参数
| 名称, 类型, 说明 |
|---|
accept string Setting to |
| 名称, 类型, 说明 |
|---|
enterprise string 必须The slug version of the enterprise name. |
“Enable access restrictions for an enterprise”的 HTTP 响应状态代码
| 状态代码 | 说明 |
|---|---|
200 | OK |
400 | Forbidden |
404 | Resource not found |
500 | Internal Error |
“Enable access restrictions for an enterprise”的示例代码
如果你通过 GHE.com 访问 GitHub,请将 api.github.com 替换为你的企业在 api.SUBDOMAIN.ghe.com 上的专用子域。
请求示例
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/enterprises/ENTERPRISE/access-restrictions/enableResponse
Status: 200{
"message": "Enterprise access restrictions successfully enabled.",
"header_name": "sec-GitHub-allowed-enterprise",
"header_value": "12345"
}