
# 查询包周期和按需资源列表
#### 功能介绍
查询用户可使用套餐和按需资源列表。
购买套餐后会生成套餐资源；创建企业时默认创建视图接入调阅、连续云存储、动检云存储、行业数据流按需资源。
#### URI
GET /v1/{user_id}/resources
表1路径参数 
| 参数      | 是否必选 | 参数类型   | 描述                                                                                                                                                                |
|:---|:---|:---|:---|
| user_id | 是    | String | 用户ID：由数字组成，长度范围\[15,25\]，获取方式参考[获取user ID与下载AK/SK](https://support.huaweicloud.com/api-ivm/ivm_03_0005.html#ZH-CN_TOPIC_0000001710465704__section1213543912215)章节 |
   
表2Query参数 
| 参数                 | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|:---|:---|:---|:---|
| limit              | 否    | Integer | 单页内显示记录数：取值范围为\[1,300\]，不填时默认为10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| offset             | 否    | Integer | 偏移量：offset为0时表示查询第一页的数据，取值范围\[0,2142147483646\]，不填写时默认为0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| resource_id        | 否    | String  | 包周期资源ID：32位数字、字母组成                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| resource_type_code | 否    | String  | 资源类型 - **MANAGE** 视图接入调阅  - **NORMAL** 连续云储存  - **DATAFLOW** 行业数据流  - **MOTION** 动检云存储   |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                    |
|:---|:---|:---|:---|
| Access-Token | 是    | String | 用户认证AccessToken：从[获取用户北向接口认证AccessToken](https://support.huaweicloud.com/api-ivm/ivm_03_0002.html)中获取 |
   
#### 响应参数
**状态码： 200**
表4响应Body参数 
| 参数        | 参数类型                                                                                  | 描述      |
|:---|:---|:---|
| total     | Integer                                                                               | 可使用资源总数 |
| resources | Array of [UserResource] objects | 资源列表    |
   
 表5UserResource 
| 参数                 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| resource_id        | String  | 资源id                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| resource_type_code | String  | 资源规格编码 - **MANAGE** 视图接入调阅  - **NORMAL** 连续云存储  - **DATAFLOW** 行业数据流  - **MOTION** 动检云存储   |
| total_num          | Integer | 资源可使用总量，套餐资源为订购的路数，按需为 -1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| usage_num          | Integer | 资源当前已使用量，设备通道每绑定一路，该使用量增加一路，反之则减少一路                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| resource_name      | String  | 资源名                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| mode               | String  | 按需或包周期 - **PACKAGE** 包周期  - **ONDEMAND** 按需                                                                                                                                                                                                                                             |
| version            | String  | 资源版本 - **ENTERPRISE** 企业版  - **ADVANCED** 高级版  - **OTHER** 其他                                                                                                                            |
| resource_state     | String  | 资源状态： - **NORMAL** 正常  - **ARREARS** 欠费  - **UNAVAILABLE** 不可使用冻结                                                                                                                             |
| Exp_time           | String  | 资源过期时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
   
#### 请求示例
查询套餐列表
```
GET /v1/48sa5478924655sa5*****/resources?offset=1&limit=15&resource_type_code=MANAGE&resource_id=c0d3c9f9b70b4c3599fe4a98e*******
```
#### 响应示例
**状态码： 200**
OK
```
{
  "total" : 2,
  "resources" : [ {
    "resource_id" : "156",
    "resource_type_code" : "MOTION",
    "resource_name" : "设备按需动检收录套餐",
    "resource_state" : "NORMAL",
    "total_num" : 1,
    "usage_num" : 0,
    "version" : "ENTERPRISE",
    "mode" : "PACKAGE ",
    "Exp_time" : "2023-09-22 02:22:00"
  }, {
    "resource_id" : "157",
    "resource_type_code" : "MOTION",
    "resource_name" : "90天动检检云存储月套餐",
    "resource_state" : "NORMAL",
    "total_num" : 1,
    "usage_num" : 0,
    "version" : "ADVANCED",
    "mode" : "ONDEMAND ",
    "Exp_time" : "2023-08-15 14:24:33"
  } ]
}
```
#### 状态码
请参见[状态码](https://support.huaweicloud.com/api-ivm/ivm_03_0136.html)
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-ivm/ivm_03_0137.html)。
