# 查询客户端列表 - ListAgent
#### 功能介绍
查询客户端列表
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-cbr/cbr_04_0017.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
GET /v3/{project_id}/agents
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述   |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID |
   
表2Query参数 
| 参数       | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                  |
|:---|:---|:---|:---|
| agent_id | 否    | String  | 客户端ID                                                                                                                                                                                                                               |
| limit    | 否    | String  | 每页显示条目数，正整数                                                                                                                                                                                                                         |
| offset   | 否    | Integer | 偏移值,正整数                                                                                                                                                                                                                             |
| status   | 否    | String  | 客户端状态，分为normal，abnormal和uninstall状态 normal:正常状态，表示客户端可以正常使用。 abnormal：异常状态，表示系统监测出系统有异常需要修复，此时部分功能可能受阻。 uninstall：卸载状态，表示客户端已被卸载或客户端正在升级过程中。 |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                     |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。 通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数     | 参数类型                                                 | 描述              |
|:---|:---|:---|
| agents | Array of [Agent] objects | 客户端实例列表         |
| count  | Integer                                              | 客户端个数           |
| limit  | Integer                                              | 每页显示的条目数量       |
| offset | Integer                                              | 偏移量，表示从此偏移量开始查询 |
   
 表5Agent 
| 参数               | 参数类型                                               | 描述                                                                                                                                                                                                                                   |
|:---|:---|:---|
| created_at       | String                                             | 客户端创建时间                                                                                                                                                                                                                              |
| updated_at       | String                                             | 客户端更新时间                                                                                                                                                                                                                              |
| agent_id         | String                                             | 客户端ID                                                                                                                                                                                                                                |
| agent_version    | String                                             | 客户端版本号                                                                                                                                                                                                                               |
| agent_type       | String                                             | 客户端类型：有native和cloud两种 native：本地客户端，客户端安装在本地。 cloud：云上客户端，客户端安装在云端。                                                                                                         |
| host_name        | String                                             | 客户端所在的主机名                                                                                                                                                                                                                            |
| host_nickname    | String                                             | 客户端所在的主机昵称                                                                                                                                                                                                                           |
| host_ip          | String                                             | 客户端所在主机的IP                                                                                                                                                                                                                           |
| host_os          | String                                             | 客户端主机所在的操作系统                                                                                                                                                                                                                         |
| status           | String                                             | 客户端状态，有normal，abnormal和uninstall三种状态 normal:正常状态，表示客户端可以正常使用。 abnormal：异常状态，表示系统监测出系统有异常需要修复，此时部分功能可能受阻。 uninstall：卸载状态，表示客户端已被卸载或客户端正在升级过程中。 |
| last_active_time | String                                             | 客户端上次激活时间                                                                                                                                                                                                                            |
| paths            | Array of [Path] objects | 客户端的备份路径                                                                                                                                                                                                                             |
   
 表6Path 
| 参数            | 参数类型   | 描述                                                                                                                                                      |
|:---|:---|:---|
| id            | String | 路径ID                                                                                                                                                    |
| status        | String | 路径状态，有available和remove两种状态 available：可用状态，表示文件备份路径状态正常，可以使用。 remove：移除状态，表示文件备份路径状态已被移除，无法使用。 |
| agent_id      | String | 该路径所属于的客户端ID                                                                                                                                            |
| dir_path      | String | 路径详情                                                                                                                                                    |
| exclude_paths | String | 排除目录列表，多个路径之间以英文逗号分隔。 说明： 该特性目前处于公测阶段,部分Region可能无法使用。                                                                                                   |
   
#### 请求示例
```
GET https://{endpoint}/v3/{project_id}/agents
```
#### 响应示例
**状态码：200**
```
{
  "count" : 2,
  "limit" : 1000,
  "offset" : 0,
  "agents" : [ {
    "created_at" : "2022-01-30T09:28:09.334+00:00",
    "agent_id" : "489654f2-363b-4ebf-966a-bdf079d97114",
    "host_name" : "eBackup",
    "host_ip" : "18.9.158.36",
    "status" : "normal",
    "last_active_time" : "2022-01-30T09:28:08.960+00:00"
  }, {
    "created_at" : "2022-01-14T06:47:17.524+00:00",
    "updated_at" : "2022-01-28T05:01:32.739+00:00",
    "agent_id" : "fb711278-e872-4224-b442-8dafc36a543d",
    "host_name" : "ecs-00001",
    "host_ip" : "10.10.0.1",
    "status" : "normal",
    "last_active_time" : "2022-01-28T05:01:32.000+00:00",
    "paths" : [ {
      "id" : "6c3d1ed6-b7d7-4e27-94ee-321431e84c5c",
      "dir_path" : "/home/hcp",
      "status" : "available",
      "agent_id" : "fb711278-e872-4224-b442-8dafc36a543d",
      "exclude_paths" : "*.txt,/opt/huaweicloud/cbragent/lib/test"
    }, {
      "id" : "e2af0fdd-9644-4db8-986e-5a6a2395c390",
      "dir_path" : "/opt/workspace",
      "status" : "available",
      "agent_id" : "fb711278-e872-4224-b442-8dafc36a543d",
      "exclude_paths" : "*.txt,/opt/huaweicloud/cbragent/lib/test"
    } ]
  } ]
}
```
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | OK |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-cbr/ErrorCode.html)。
