314.md 5.3 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
# 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: <your_access_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: <your_access_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: <your_access_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: <your_access_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: <your_access_token>" --request DELETE "https://gitlab.example.com/api/v4/projects/1/feature_flags_user_lists/1" 
```