All Products
Search
Document Center

BSS OpenAPI:QuerySavingsPlansDiscount

Last Updated:Aug 14, 2024

Queries discounts on savings plans.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
bssapi:QuerySavingsPlansDiscountget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ModuleCodestringNo

The code of the pricing module.

instance_type
PayModestringYes

The payment mode. Valid values: total: all upfront. half: half upfront. zero: no upfront.

total
PageSizeintegerNo

The number of entries to return on each page.

20
SpnTypestringYes

The type of the savings plan. Valid values: ecs: Elastic Compute Service (ECS) compute type. universal: general-purpose type.

universal
LocalestringNo

The identifier of the language.

Valid values:

  • EN: English.
  • ZH: Chinese.
ZH
CyclestringYes

The cycle based on which queries are performed.

1:Year
PageNumintegerNo

The number of the page to return.

1
SpecstringNo

The type of the resource.

ecs.g6
CommodityCodestringYes

The code of the service.

ecs
RegionstringNo

The ID of the region.

cn-hangzhou

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

Messagestring

The error message returned.

This API is not applicable for caller.
RequestIdstring

The ID of the request.

6000EE23-274B-4E07-A697-FF2E999520A4
Dataobject

data

HostIdstring

The IP address of the request.

100.104.180.109
Itemsarray<object>

The information about the discounts on saving plans.

object

The details of the discount.

CommodityNamestring

The details of the service.

Pay-as-you-go Elastic Compute Service (ECS) instance
ModuleNamestring

The name of the pricing module.

Instance
SpnTypestring

The type of the savings plan.

universal
PayModestring

The payment mode. Valid values:

  • total: all upfront
  • half: half upfront
  • zero: no upfront
total
Cyclestring

The cycle based on which queries were performed.

1:Year
Regionstring

The ID of the region.

cn-zhangjiakou-na62-a01
RegionCodestring

The region ID of the instance. You can call the DescribeDBInstanceAttribute operation to query the region ID of the instance.

cn-hangzhou
Specstring

The type of the resource.

ecs.g6
DiscountRatestring

The discount provided by the official website.

0.85
ContractDiscountRatestring

The contracted discount.

0.85
Codestring

The error code returned.

PARAM_ERROR
Successboolean

Indicates whether the request is successful.

true

Examples

Sample success responses

JSONformat

{
  "Message": "This API is not applicable for caller.",
  "RequestId": "6000EE23-274B-4E07-A697-FF2E999520A4",
  "Data": {
    "HostId": "100.104.180.109",
    "Items": [
      {
        "CommodityName": "Pay-as-you-go Elastic Compute Service (ECS) instance\n",
        "ModuleName": "Instance\n",
        "SpnType": "universal",
        "PayMode": "total",
        "Cycle": "1:Year",
        "Region": "cn-zhangjiakou-na62-a01",
        "RegionCode": "cn-hangzhou",
        "Spec": "ecs.g6",
        "DiscountRate": "0.85",
        "ContractDiscountRate": "0.85"
      }
    ]
  },
  "Code": "PARAM_ERROR",
  "Success": true
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-05-25The response structure of the API has changedView Change Details
2022-12-23The internal configuration of the API is changed, but the call is not affectedView Change Details