Help us learn about your current experience with the documentation. Take the survey.

组织 API

  • 版本:Free, Premium, Ultimate
  • 产品:GitLab.com, GitLab Self-Managed
  • 状态:实验

使用此 API 与 GitLab 组织进行交互。更多信息,请参阅 组织

创建组织

此功能的可用性由功能标志控制。 更多信息,请参阅历史记录。

创建一个新组织。

此端点为实验性功能,可能会随时更改或移除,恕不另行通知。

POST /organizations

参数:

属性 类型 是否必需 描述
name string 组织的名称
path string 组织的路径
description string 组织的描述
avatar file 组织的头像图片

请求示例:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--form "name=新组织" \
--form "path=new-org" \
--form "description=一个新组织" \
--form "avatar=@/path/to/avatar.png" \
"https://gitlab.example.com/api/v4/organizations"

响应示例:

{
  "id": 42,
  "name": "新组织",
  "path": "new-org",
  "description": "一个新组织",
  "created_at": "2024-09-18T02:35:15.371Z",
  "updated_at": "2024-09-18T02:35:15.371Z",
  "web_url": "https://gitlab.example.com/-/organizations/new-org",
  "avatar_url": "https://gitlab.example.com/uploads/-/system/organizations/organization_detail/avatar/42/avatar.png"
}