我们最近移动了一些 REST API 文档。 如果找不到要查找的内容,可以尝试 操作 REST API 页面。
组织
使用 REST API 在企业中创建组织。
Create an organization
“Create an organization”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
login string 必须The organization's username. |
admin string 必须The login of the user who will manage this organization. |
profile_name string The organization's display name. |
“Create an organization”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
201 | Created |
“Create an organization”的示例代码
post/admin/organizations
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://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
“Update an organization name”的参数
名称, 类型, 说明 |
---|
accept string Setting to |
名称, 类型, 说明 |
---|
org string 必须The organization name. The name is not case sensitive. |
名称, 类型, 说明 |
---|
login string 必须The organization's new name. |
“Update an organization name”的 HTTP 响应状态代码
状态代码 | 说明 |
---|---|
202 | Accepted |
“Update an organization name”的示例代码
patch /admin /organizations /{org}
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/admin/organizations/ORG \
-d '{"login":"the-new-octocats"}'
Response