此版本的 GitHub Enterprise 已停止服务 2022-06-03. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持。
We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the Actions REST API page.
组织
组织管理 API 允许您在企业上创建组织。
它只适用于经过身份验证的站点管理员。普通用户尝试访问它时会收到 404
响应。
Create an organization
参数
� �头 |
---|
名称, 类型, 描述 |
accept stringSetting to |
正文参数 |
名称, 类型, 描述 |
login string必选The organization's username. |
admin string必选The login of the user who will manage this organization. |
profile_name stringThe organization's display name. |
HTTP 响应状态代� �
状态代� � | 描述 |
---|---|
201 | Created |
代� �示例
post/admin/organizations
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/organizations \
-d '{"login":"github","profile_name":"GitHub, Inc.","admin":"monalisaoctocat"}'
Response
Status: 201
{
"login": "github",
"id": 1,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
"url": "https://api.github.com/orgs/github",
"repos_url": "https://api.github.com/orgs/github/repos",
"events_url": "https://api.github.com/orgs/github/events",
"hooks_url": "https://api.github.com/orgs/github/hooks",
"issues_url": "https://api.github.com/orgs/github/issues",
"members_url": "https://api.github.com/orgs/github/members{/member}",
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}
Update an organization name
参数
� �头 |
---|
名称, 类型, 描述 |
accept stringSetting to |
路径参数 |
名称, 类型, 描述 |
org string必选The organization name. The name is not case sensitive. |
正文参数 |
名称, 类型, 描述 |
login string必选The organization's new name. |
HTTP 响应状态代� �
状态代� � | 描述 |
---|---|
202 | Accepted |
代� �示例
patch/admin/organizations/{org}
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/organizations/ORG \
-d '{"login":"the-new-octocats"}'
Response
Status: 202
{
"message": "Job queued to rename organization. It may take a few minutes to complete.",
"url": "https://<hostname>/api/v3/organizations/1"
}