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

功能标志用户列表 API

  • 版本:Free, Premium, Ultimate
  • 产品:GitLab.com, GitLab Self-Managed, GitLab Dedicated

使用此 API 与 GitLab 的用户列表功能标志进行交互。

前提条件:

  • 您至少需要拥有开发者角色。

要与所有用户的功能标志进行交互,请参阅功能标志 API

列出项目的所有功能标志用户列表

获取所请求项目的所有功能标志用户列表。

GET /projects/:id/feature_flags_user_lists

使用 pageper_page 分页 参数来 控制结果的分页。

属性 类型 必需 描述
id integer/string 项目的 ID 或URL 编码路径
search string 返回符合搜索条件的用户列表。
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists"

示例响应:

[
   {
      "name": "user_list",
      "user_xids": "user1,user2",
      "id": 1,
      "iid": 1,
      "project_id": 1,
      "created_at": "2020-02-04T08:13:51.423Z",
      "updated_at": "2020-02-04T08:13:51.423Z"
   },
   {
      "name": "test_users",
      "user_xids": "user3,user4,user5",
      "id": 2,
      "iid": 2,
      "project_id": 1,
      "created_at": "2020-02-04T08:13:10.507Z",
      "updated_at": "2020-02-04T08:13:10.507Z"
   }
]

创建功能标志用户列表

创建功能标志用户列表。

POST /projects/:id/feature_flags_user_lists
属性 类型 必需 描述
id integer/string 项目的 ID 或URL 编码路径
name string 列表的名称。
user_xids string 以逗号分隔的外部用户 ID 列表。
curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-type: application/json" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists" \
  --data @- << EOF
{
    "name": "my_user_list",
    "user_xids": "user1,user2,user3"
}
EOF

示例响应:

{
   "name": "my_user_list",
   "user_xids": "user1,user2,user3",
   "id": 1,
   "iid": 1,
   "project_id": 1,
   "created_at": "2020-02-04T08:32:27.288Z",
   "updated_at": "2020-02-04T08:32:27.288Z"
}

获取功能标志用户列表

获取功能标志用户列表。

GET /projects/:id/feature_flags_user_lists/:iid

使用 pageper_page 分页 参数来 控制结果的分页。

属性 类型 必需 描述
id integer/string 项目的 ID 或URL 编码路径
iid integer/string 项目功能标志用户列表的内部 ID。
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1"

示例响应:

{
   "name": "my_user_list",
   "user_xids": "123,456",
   "id": 1,
   "iid": 1,
   "project_id": 1,
   "created_at": "2020-02-04T08:13:10.507Z",
   "updated_at": "2020-02-04T08:13:10.507Z"
}

更新功能标志用户列表

更新功能标志用户列表。

PUT /projects/:id/feature_flags_user_lists/:iid
属性 类型 必需 描述
id integer/string 项目的 ID 或URL 编码路径
iid integer/string 项目功能标志用户列表的内部 ID。
name string 列表的名称。
user_xids string 以逗号分隔的外部用户 ID 列表。
curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-type: application/json" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1" \
  --data @- << EOF
{
    "user_xids": "user2,user3,user4"
}
EOF

示例响应:

{
   "name": "my_user_list",
   "user_xids": "user2,user3,user4",
   "id": 1,
   "iid": 1,
   "project_id": 1,
   "created_at": "2020-02-04T08:32:27.288Z",
   "updated_at": "2020-02-05T09:33:17.179Z"
}

删除功能标志用户列表

删除功能标志用户列表。

DELETE /projects/:id/feature_flags_user_lists/:iid
属性 类型 必需 描述
id integer/string 项目的 ID 或URL 编码路径
iid integer/string 项目功能标志用户列表的内部 ID
curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1"