GetPrice【获取资源配置单价】

获取资源配置单价:可根据资源类型,资源配额,来获取单价信息。 如果不指定任何过滤条件,则会返回错误信息。

Request Parameters

Parameter name Type Description Required
action String API 标识符 Yes
billing_type String 计费类型,有效值有hour,month Yes
resource Dict 资源信息,每项参数可见下面 Resource Item Yes

Resource Item

Key name Type Description Required
type String

资源类型,有效值 instance,volume,router,floatingip, bandwidth,cdn_flow

instance:云主机(与参数image,flavor,disk,count配合使用)
volume: 云硬盘(与参数volumeSize配合使用)
router:路由器
floatingip:公网 IP
bandwidth:总带宽(与参数size,physical_network配合使用)
cdn_flow:CDN流量(与参数flow_gb配合使用)
Yes
image String 镜像 ID 当type为instance时需指定
flavor String 资源配额 当type为instance时需指定
disk String 系统盘大小 当type为instance时需指定
count String 资源数量 当type为instance时需指定
volumeSize Integer 云硬盘大小(单位:GB ) 当type为volume时需指定
size String 带宽大小(单位:Mbps) 当type为bandwidth时需指定
physical_network String 物理网络,有效值为“physnet1” 当type为bandwidth时需指定
flow_gb String CDN 流量包(单位:GB) 当type为cdn_flow时需指定

Response Elements

Name Type Description
message String 执行结果信息
code Integer HTTP Resonpe响应状态码
data Dict 资源单价信息列表,每项参数可见下面 Data Item

Data Item

Name Type Description
price String 每小时单价
30day_price String 每月单价

Example

Example Request:

Request Headers:

POST /api/ HTTP/1.1
Origin: https://console.plcloud.com
X-CSRFToken: 6An6xEuOJqW6dVDtlgzZr6FqgkSbJmqp
Content-Type: application/json

JSON Data:

{
    "action": "GetPrice",
    "billing_type": "hour",
    "resource": {
        "type": "instance",
        "image": "ee9eb9e4-77ef-43e3-9f5f-dbf749938f63",
        "flavor": "11",
        "disk": "40",
        "count": "1"
    }
}

Example Response:

{
  "message": "成功",
  "code": 200,
  "data": {
    "price": "0.152748",
    "30day_price": "109.98"
  }
}