# 查询包年/包月产品价格-ListRateOnPeriodDetail
#### 功能介绍
伙伴在销售平台按照条件查询包年/包月产品开通时候的价格。
如果购买该产品的客户享受折扣，可以在查询结果中返回折扣金额以及扣除折扣后的最后成交价。
如果该客户享受多种折扣，系统会返回每种折扣的批价结果。如果客户在下单的时候选择自动支付，则系统会优先应用商务折扣的批价结果。
![](https://support.huaweicloud.com/api-bpconsole/public_sys-resources/caution_3.0-zh-cn.png)
- 华为云根据云服务类型、资源类型、云服务区和资源规格四个条件来查询产品，查询时请确认这4个查询条件均输入正确，否则该接口会返回无法找到产品的错误。
- 如果只是临时查询产品价格，可以到[价格计算器](https://www.huaweicloud.com/pricing/calculator.html#/ecs)查询。
- 询价Api入参参数product_infos取值可以参考价格计算器查询入参，详情见[包周期询价示例](https://support.huaweicloud.com/api-bpconsole/csdp_faq_062501.html)。
 
#### 接口约束
该接口可以使用解决方案提供商或华为云总经销商（一级经销商）置换子客户的Token调用，置换前需[伙伴申请客户授权](https://support.huaweicloud.com/usermanual-bpconsole/dp_050102.html)或[客户给伙伴创建委托](https://support.huaweicloud.com/usermanual-iam/iam_06_0002.html)。
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=BSS&api=ListRateOnPeriodDetail)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
伙伴操作员账号调用当前API无需授权。
#### URI
POST /v2/bills/ratings/period-resources/subscribe-rate
#### 请求消息
**请求参数**
| 参数            | 是否必选 | 参数类型                          | 取值范围       | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|:---|:---|:---|:---|:---|
| project_id | 是    | String                     | 最大长度：64    | 项目ID。 说明： - 使用客户Token，可以调用[通过assume_role方式获取用户token](https://support.huaweicloud.com/api-iam/iam_30_0003.html)接口获取"regionId"的取值对应的"project id"。具体请参见[如何将合作伙伴Token置换为客户Token](https://support.huaweicloud.com/bpconsole_faq/bpconsole_apifaq_00001.html)的步骤2。  - IAM子用户调用此接口，需要IAM主账号授权，具体请参考[创建用户组并授权](https://support.huaweicloud.com/usermanual-iam/iam_03_0001.html)。   |
| product_infos | 是  | List\<PeriodProductInfo\> | 最大个数：100 | 产品信息列表，询价时要询价产品的信息的列表，具体参见[表1]。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
   
 表1PeriodProductInfo 
| 参数                     | 是否必选 | 参数类型       | 取值范围            | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|:---|
| id                       | 是    | String     | 最大长度：64            | ID标识，同一次询价中不能重复，用于标识返回询价结果和请求的映射关系。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| cloud_service_type    | 是    | String     | 最大长度：400         | 云服务类型编码，例如OBS的云服务类型编码为"hws.service.type.obs"。您可以调用[查询云服务类型列表-ListServiceTypes](https://support.huaweicloud.com/api-bpconsole/zh-cn_topic_0000001256679455.html)接口获取。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| resource_type            | 是     | String    | 最大长度：400          | 资源类型编码，例如ECS的VM为"hws.resource.type.vm"。您可以调用[查询资源类型列表-ListResourceTypes](https://support.huaweicloud.com/api-bpconsole/zh-cn_topic_0000001256519451.html)接口获取。 ResourceType是CloudServiceType中的一种资源，CloudServiceType由多种ResourceType组合提供。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| resource_spec           | 是      | String    | 最大长度：400         | 云服务类型的资源规格。详情请参见各云服务官方文档。 部分云服务类型和资源规格举例如下： - 弹性云服务器： 根据操作系统类型在云服务器规格的ID后添加".win"或".linux"，例如"s2.small.1.linux"。云服务器规格的ID字段，您可以调用[查询规格详情和规格扩展信息列表](https://support.huaweicloud.com/api-ecs/zh-cn_topic_0020212656.html)接口获取。   - 带宽： - 12_bgp：动态BGP按流量计费带宽  - 12_sbgp：静态BGP按流量计费带宽  - 19_bgp：动态BGP按带宽计费带宽  - 19_sbgp：静态BGP按带宽计费带宽  - 19_share：按带宽计费共享带宽    - IP： - 5_bgp：动态BGP公网IP  - 5_sbgp：静态BGP公网IP    - 云数据库： 云数据库的资源规格信息，您可以调用[查询数据库规格](https://support.huaweicloud.com/api-rds/rds_06_0002.html)接口获取。   - 分布式缓存服务： 分布式缓存服务的资源规格信息，您可以调用[查询产品规格](https://support.huaweicloud.com/api-dcs/ListFlavors.html)接口获取。   - 云硬盘： - SATA：普通IO云硬盘  - SAS：高IO云硬盘  - GPSSD：通用型SSD云硬盘  - SSD：超高IO云硬盘  - ESSD：极速型SSD云硬盘  - GPSSD2.storage：通用型SSD V2云硬盘容量（归属的云盘类型为GPSSD2）     |
| region                   | 是   | String    | 最大长度：64           | 云服务区编码，例如："cn-north-1"。具体请参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)对应云服务的"区域"列的值。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| period_type            | 是    | Integer | \[0-4\]           | 订购包年/包月产品的周期类型。 - 0：天  - 2：月  - 3：年  - 4：小时                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| period_num              | 是   | Integer   | \[1-214783647\] | 订购包年/包月产品的周期数。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| subscription_num        | 是   | Integer     | \[1-10000\]      | 订购包年/包月产品的数量。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| available_zone         | 否    | String      | 最大长度：64            | 可用区标识，例如："cn-north-1a"，大小写不敏感。具体请参见[地区和终端节点](https://developer.huaweicloud.com/endpoint)可用分区的"可用分区名称"列的值。 此参数不携带或携带值为空串或携带值为null时，不作为筛选条件。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| resource_size          | 否   | Integer    | \[1-214783647\]  | 资源容量大小，例如购买的卷大小或带宽大小。 线性产品时此参数必填。线性产品为包括硬盘，带宽等在订购时需要指定大小的产品。例如硬盘在订购时需选择10G、20G等不同大小。 非线性产品时此参数不携带或者携带值为null时，不作为筛选条件。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| size_measure_id          | 否    | Integer     | -                | 资源容量度量标识。 - 15：Mbps（购买带宽时使用）  - 17：GB（购买云硬盘时使用）  - 14：个   线性产品时该参数必填。线性产品为包括硬盘，带宽等在订购时需要指定大小的产品。例如硬盘在订购时需选择10G、20G等不同大小。 非线性产品时此参数不携带或者携带值为null时，不作为筛选条件。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| fee_installment_mode | 否   | String  | 最大长度：64          | 费用分期模式。 - HALF_PAY：半付  - ZERO_PAY：零付  - NA：不支持费用分期模式   说明： - 此参数不携带或携带值为空串或携带值为null时，默认值为"NA"。  - 暂只支持CloudPond产品。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
   
**请求示例**
```
POST https://bss.myhuaweicloud.com/v2/bills/ratings/period-resources/subscribe-rate HTTP/1.1
Content-Type: application/json
X-Auth-Token：MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
    "project_id": "84c53ec51e794a4888fb0f5c0cfb2420",
    "product_infos": [
        {
            "id": "1",
   "cloud_service_type": "hws.service.type.ec2",
   "resource_type": "hws.resource.type.vm",
           "resource_spec": "c6.2xlarge.2.linux",
   "region": "cn-north-1",
   "available_zone": "cn-east-3a",
   "resource_size": null,
   "size_measure_id": null,
   "period_type": 2,
   "period_num": 1,
   "subscription_num": 1
        },
        {
   "id": "2",
   "cloud_service_type": "hws.service.type.vpc",
   "resource_type": "hws.resource.type.ip",
   "resource_spec": "5_bgp",
   "region": "cn-north-1",
   "available_zone": null,
   "resource_size": null,
   "size_measure_id": 15,
   "period_type": 2,
   "period_num": 1,
   "subscription_num": 1
        },
        {
    "id": "3",
   "cloud_service_type": "hws.service.type.ebs",
   "resource_type": "hws.resource.type.volume",
   "resource_spec": "GPSSD",
   "region": "cn-north-1",
   "available_zone": "cn-east-3a",
   "resource_size": 40,
   "size_measure_id": 17,
   "period_type": 2,
   "period_num": 1,
   "subscription_num": 1
         },
         {
           "id": "4",
   "cloud_service_type": "hws.service.type.vpc",
   "resource_type": "hws.resource.type.bandwidth",
   "resource_spec": "19_bgp",
   "region": "cn-north-1",
   "available_zone":"cn-east-3a",
   "resource_size": 40,
   "size_measure_id": 15,
   "period_type": 2, 
   "period_num": 1,
   "subscription_num": 1
         },
         {
            "id": "5",
            "cloud_service_type": "hws.service.type.ies",
            "resource_type": "hws.resource.type.iesserver",
            "resource_spec": "ies.cbu.4c6",
            "region": "global-cbc-1",
            "period_type": 2,
            "period_num": 1,
            "subscription_num": 1,
            "resource_size":10,
            "size_measure_id":null,
            "fee_installment_mode":"HALF_PAY"
        }
    ]
}
```
#### 响应消息
**响应参数**
| 参数                                 | 参数类型                                    | 取值范围       | 描述                                                                                       |
|:---|:---|:---|:---|
| error_code                        | String                               | 最大长度：20     | 状态码。具体请参考[状态码]。只有失败才返回该字段。                       |
| error_msg                        | String                               | 最大长度：1000 | 错误描述信息。只有失败才返回该字段。                                                                       |
| official_website_rating_result    | OfficialWebsiteRatingResult Object   | -           | 包年/包月产品的官网价格查询结果，具体参见[表2]。                            |
| optional_discount_rating_results | List\<OptionalDiscountRatingResult\> | -           | 存在可选折扣优惠时返回折扣优惠维度询价结果，每个折扣优惠一组询价结果，具体参见[表4]。      |
| currency                        | String                              | 最大长度：20     | 币种。 CNY：人民币。 值为空代表人民币。 |
   
 表2OfficialWebsiteRatingResult 
| 参数                                    | 参数类型                                       | 取值范围    | 描述                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| official_website_amount             | BigDecimal                            | -      | 包年/包月产品的官网价格。                                                                                                                                                                                                                                   |
| installment_official_website_amount | String                                   | -       | 分期金额的官网价。 说明： 暂只支持CloudPond产品。                                                                                                                                                                                  |
| installment_period_type           | Integer                                 | -      | 分期付款的周期类型。 - 2：月  - 3：年   说明： 暂只支持CloudPond产品。 |
| measure_id                           | Integer                                | 最大长度：4 | 价格度量单位标识。 1：元                                                                                                                                                                                                       |
| product_rating_results               | List\<PeriodProductOfficialRatingResult\> | -      | 包年/包月产品的询价结果，具体参见[表3]。                                                                                                                                                                                           |
   
 表3PeriodProductOfficialRatingResult 
| 参数                                   | 参数类型        | 取值范围    | 描述                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| id                                  | String         | 最大长度：64  | ID标识，来源于请求中的ID。                                                                                                                                                                                                                                 |
| product_id                           | String      | 最大长度：64 | 包年/包月产品ID。                                                                                                                                                                                                                                       |
| official_website_amount             | BigDecimal | -     | 包年/包月产品的官网价格。                                                                                                                                                                                                                                    |
| measure_id                            | Integer      | 最大长度：4  | 价格的度量单位标识。 - 1：元                                                                                                                               |
| installment_official_website_amount | String      | -     | 分期金额的官网价。 说明： 暂只支持CloudPond产品。                                                                                                                                                                                   |
| installment_period_type             | Integer     | -       | 分期付款的周期类型。 - 2：月  - 3：年   说明： 暂只支持CloudPond产品。 |
   
 表4OptionalDiscountRatingResult 
| 参数                                 | 参数类型                             | 取值范围      | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| discount_id                           | String                              | 最大长度：64  | 折扣优惠ID。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| amount                            | BigDecimal                        | -         | 总额，即最终优惠后的金额。 amount= official_website_amount - discountAmount。                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| official_website_amount            | BigDecimal                        | -          | 包年/包月产品的官网价。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| discount_amount                     | BigDecimal                       | -       | 可选折扣优惠额，如商务折扣、伙伴折扣、促销折扣和折扣券选用时的优惠额。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| measure_id                        | Integer                          | 最大长度：4    | 价格度量单位标识。 1：元                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| discount_type                       | Integer                             | 最大长度：32  | 折扣优惠类型。 - 商务授权折扣： 605：华为云BE场景下的合同商务折扣   - 伙伴授予折扣： 606：分销商BE场景下的合同商务折扣     - 伙伴设置折扣： 607：合作伙伴设置折扣-折扣率    |
| discount_name                      | String                              | 最大长度：256   | 折扣名称。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| best_offer                           | Integer                           | -        | 是否为最优折扣。 - 0：不是最优折扣，为缺省值。  - 1：是最优折扣 最优折扣：在商务折扣、伙伴折扣中选择（优惠金额最大的折扣为最优，优惠金额相等则按此顺序排优先级），促销折扣，折扣券不参与最优折扣的计算。                                                                                                                                                                                                          |
| product_rating_results             | List\<PeriodProductRatingResult\> | -         | 产品询价结果，具体参见[表5]。                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| installment_official_website_amount  | String                               | 最大长度：64    | 分期金额的官网价。 说明： 暂只支持CloudPond产品。                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| installment_official_discount_amount | String                            | 最大长度：64 | 分期金额的折扣价。 说明： 暂只支持CloudPond产品。                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| installment_amount                  | String                            | 最大长度：64   | 分期金额的成交价。 说明： - 分期金额的成交价=分期金额的官网价-分期金额的折扣价。  - 暂只支持CloudPond产品。                                                                                                                                                                                                                                                                                                 |
| installment_period_type            | Integer                          | -        | 分期付款的周期类型。 - 2：月  - 3：年   说明： 暂只支持CloudPond产品。                                                                                                                                                                                                                                                                                          |
   
 表5PeriodProductRatingResult 
| 参数                                    | 参数类型      | 取值范围    | 描述                                                                                                                                                                                                                                               |
|:---|:---|:---|:---|
| id                                  | String      | 最大长度：64   | ID标识，来源于请求中的ID。                                                                                                                                                                                                                                  |
| product_id                          | String      | 最大长度：64   | 包年/包月产品的ID。                                                                                                                                                                                                                                     |
| amount                                | BigDecimal  | -       | 总额，即最终优惠后的金额。 amount= official_website_amount - discountAmount。                                                                                                                                                |
| official_website_amount              | BigDecimal | -         | 包年/包月产品的官网价。                                                                                                                                                                                                                                      |
| discount_amount                     | BigDecimal | -         | 可选折扣优惠额，如商务折扣、伙伴折扣、促销折扣和折扣券选用时的优惠额。                                                                                                                                                                                                               |
| measure_id                             | Integer    | 最大长度：4    | 价格度量单位标识。 1：元                                                                                                                                                                                                    |
| installment_official_website_amount   | String      | 最大长度：64 | 分期金额的官网价。 说明： 暂只支持CloudPond产品。                                                                                                                                                                                   |
| installment_official_discount_amount | String     | 最大长度：64   | 分期金额的折扣价。 说明： 暂只支持CloudPond产品。                                                                                                                                                                                  |
| installment_amount                    | String      | 最大长度：64   | 分期金额的成交价。 说明： - 分期金额的成交价=分期金额的官网价-分期金额的折扣价。  - 暂只支持CloudPond产品。               |
| installment_period_type              | Integer   | -        | 分期付款的周期类型。 - 2：月  - 3：年   说明： 暂只支持CloudPond产品。 |
   
**响应示例**
```
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time 
{
    "official_website_rating_result": {
        "official_website_amount": 3777.2,
        "installment_official_website_amount": null,
        "installment_period_type": null,
        "measure_id": 1,
        "product_rating_results": [
            {
                "id": "1",
                "product_id": "00301-233377-0--0",
                "official_website_amount": 834.2,
                "measure_id": 1,
                "installment_official_website_amount": null,
                "installment_period_type": null,
                "installment_official_website_amount": "1003.33",
                "installment_official_discount_amount": "150.50",
                "installment_amount": "852.83",
                "installment_period_type": 2
            },
            {
                "id": "2",
                "product_id": "da27d47d84ff4adba7de3ca3b0c9ce08",
                "official_website_amount": 0,
                "measure_id": 1,
                "installment_official_website_amount": null,
                "installment_period_type": null,
                "installment_official_website_amount": "1003.33",
                "installment_official_discount_amount": "150.50",
                "installment_amount": "852.83",
                "installment_period_type": 2
            },
            {
                "id": "3",
                "product_id": "OFFI535014055638646785",
                "official_website_amount": 28,
                "measure_id": 1,
                "installment_official_website_amount": null,
                "installment_period_type": null,
                "installment_official_website_amount": "1003.33",
                "installment_official_discount_amount": "150.50",
                "installment_amount": "852.83",
                "installment_period_type": 2
            },
            {
                "id": "4",
                "product_id": "60564b0c1f484feaad26cda1acc6d4d8",
                "official_website_amount": 2915,
                "measure_id": 1,
                "installment_official_website_amount": null,
                "installment_period_type": null,
                "installment_official_website_amount": "1003.33",
                "installment_official_discount_amount": "150.50",
                "installment_amount": "852.83",
                "installment_period_type": 2
            },
            {
                "id": "5",
                "product_id": "OFFI67********74347776",
                "official_website_amount": 8.33,
                "measure_id": 1,
                "installment_official_website_amount": "1003.33",
                "installment_period_type": 2,
                "installment_official_website_amount": "1003.33",
                "installment_official_discount_amount": "150.50",
                "installment_amount": "852.83",
                "installment_period_type": 2
            }
        ]
    },
    "optional_discount_rating_results": [
            ],
    "currency": "CNY"
}
```
 #### 状态码
![](https://support.huaweicloud.com/api-bpconsole/public_sys-resources/note_3.0-zh-cn.png)
- 状态码4xx：由于明显的客户端错误（例如，格式错误的请求语法、参数错误等），华为云会返回4xx错误码，请及时检查请求消息的正确性，重新发起请求。
- 状态码5xx：由于华为云系统原因，导致无法完成明显有效请求的处理，可及时联系华为云客服处理。
 
| HTTP状态码 | 错误码         | 错误描述         |
|:---|:---|:---|
| 400     | CBC.0100   | 参数错误。        |
| 400     | CBC.99006006 | 产品未发现。      |
| 400    | CBC.99006055 | 询价结果超过金额最大限制。 |
| 403      | CBC.0151     | 拒绝访问。         |
| 429     | CBC.0250     | 消息流量控制。      |
| 500     | CBC.0999   | 其他错误。        |
   
