# Feature flag user lists API > 原文:[https://docs.gitlab.com/ee/api/feature_flag_user_lists.html](https://docs.gitlab.com/ee/api/feature_flag_user_lists.html) * [List all feature flag user lists for a project](#list-all-feature-flag-user-lists-for-a-project) * [Create a feature flag user list](#create-a-feature-flag-user-list) * [Get a feature flag user list](#get-a-feature-flag-user-list) * [Update a feature flag user list](#update-a-feature-flag-user-list) * [Delete feature flag user list](#delete-feature-flag-user-list) # Feature flag user lists API[](#feature-flag-user-lists-api-premium "Permalink") [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/205409) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.10. 用于访问 GitLab 功能标志用户列表的 API. 具有开发者或更高[权限的用户](../user/permissions.html)可以访问功能标志用户列表 API. **注意:** `GET`请求一次返回 20 个结果,因为 API 结果是[分页的](README.html#pagination) . 您可以更改此值. ## List all feature flag user lists for a project[](#list-all-feature-flag-user-lists-for-a-project "Permalink") 获取所请求项目的所有功能标志用户列表. ``` GET /projects/:id/feature_flags_user_lists ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 项目的 ID 或[URL 编码的路径](README.html#namespaced-path-encoding) . | ``` curl --header "PRIVATE-TOKEN: " "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" } ] ``` ## Create a feature flag user list[](#create-a-feature-flag-user-list "Permalink") 创建功能标记用户列表. ``` POST /projects/:id/feature_flags_user_lists ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 项目的 ID 或[URL 编码的路径](README.html#namespaced-path-encoding) . | | `name` | string | yes | 功能标志的名称. | | `user_xids` | string | yes | 以逗号分隔的用户 ID 列表. | ``` curl "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists" \ --header "PRIVATE-TOKEN: " \ --header "Content-type: application/json" \ --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 a feature flag user list[](#get-a-feature-flag-user-list "Permalink") 获取功能标志用户列表. ``` GET /projects/:id/feature_flags_user_lists/:iid ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 项目的 ID 或[URL 编码的路径](README.html#namespaced-path-encoding) . | | `iid` | integer/string | yes | 项目的功能标志用户列表的内部 ID. | ``` curl --header "PRIVATE-TOKEN: " "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", } ``` ## Update a feature flag user list[](#update-a-feature-flag-user-list "Permalink") 更新功能标志用户列表. ``` PUT /projects/:id/feature_flags_user_lists/:iid ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 项目的 ID 或[URL 编码的路径](README.html#namespaced-path-encoding) . | | `iid` | integer/string | yes | 项目的功能标志用户列表的内部 ID. | | `name` | string | no | 功能标志的名称. | | `user_xids` | string | no | 以逗号分隔的用户 ID 列表. | ``` curl "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1" \ --header "PRIVATE-TOKEN: " \ --header "Content-type: application/json" \ --request PUT \ --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 feature flag user list[](#delete-feature-flag-user-list "Permalink") 删除功能标志用户列表. ``` DELETE /projects/:id/feature_flags_user_lists/:iid ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 项目的 ID 或[URL 编码的路径](README.html#namespaced-path-encoding) . | | `iid` | integer/string | yes | 项目的功能标志用户列表的内部 ID | ``` curl --header "PRIVATE-TOKEN: " --request DELETE "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1" ```