All Products
Search
Document Center

BSS OpenAPI:QuerySavingsPlansInstance

Last Updated:Mar 01, 2024

Queries the information about savings plan instances of the current user.

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:QuerySavingsPlansInstanceREAD
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
PageSizeintegerNo

The number of entries to return on each page.

20
LocalestringNo

The language of the return data. Valid values:

  • ZH: Chinese
  • EN: English
ZH
PageNumintegerNo

The number of the page to return.

1
InstanceIdstringNo

The ID of the savings plan instance.

spn-xxxxxxx
StartTimestringNo

The beginning of the time range to query. Specify the time in the format of yyyy-MM-dd HH:mm:ss.

2020-01-01 00:00:00
EndTimestringNo

The end of the time range to query. Specify the time in the format of yyyy-MM-dd HH:mm:ss.

2021-01-01 00:00:00
Tagobject []No

The tags.

KeystringNo

The key of the tag to query.

ecs
ValuestringNo

The value of the tag to query.

001
StatusstringNo

The status of the Instance.

  • NORMAL
  • RELEASE
NORMAL

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The error code.

Success
Messagestring

The message returned.

Successful
RequestIdstring

The ID of the request.

61293E7A-3406-4447-8620-EC88B0AA66AD
Successboolean

Indicates whether the operation was successful.

true
Dataobject

The return data.

PageNuminteger

The page number of the returned page.

1
PageSizeinteger

The number of entries returned per page.

20
TotalCountinteger

The total number of entries.

100
Itemsobject []

The details about the instances.

Statusstring

The status of the instance. Valid values:

  • NORMAL: normal
  • LIMIT: stopped due to overdue payment
  • RELEASE: released
NORMAL
SavingsTypestring

The type of the savings plan. Valid values:

  • universal: general-purpose
  • ecs: ECS compute
ECS
Utilizationstring

The total usage.

1.0
PrepayFeestring

The prepaid amount.

8760.00
InstanceIdstring

The ID of the savings plan instance.

spn-xxxxxxxx
Currencystring

The currency. Valid values: CNY and USD.

CNY
EndTimestring

The time when the instance expires. The time is in the format of yyyy-MM-dd HH:mm:ss.

2021-01-01 00:00:00
StartTimestring

The time when the instance takes effect. The time is in the format of yyyy-MM-dd HH:mm:ss.

2020-01-01 00:00:00
AllocationStatusstring

The allocation status. Valid values:

  • unallocated
  • allocated
  • beAllocated
unallocated
InstanceFamilystring

The instance family information. For an instance of the Elastic Compute Service (ECS) compute type, the value indicates the ECS instance family or the ECS instance family package.

ecs.g6
Regionstring

The region.

cn-zhangjiakou-na62-a01
TotalSavestring

The total amount that is saved.

20.00
PoolValuestring

The commitment.

1.00
PayModestring

The payment type. Valid values:

  • total: All Upfront
  • half: Partial Upfront
  • zero: No Upfront
total
Tagsobject []

The details about the tags.

Keystring

The key of the tag.

Valuestring

The value of the tag.

Examples

Sample success responses

JSONformat

{
  "Code": "Success",
  "Message": "Successful",
  "RequestId": "61293E7A-3406-4447-8620-EC88B0AA66AD",
  "Success": true,
  "Data": {
    "PageNum": 1,
    "PageSize": 20,
    "TotalCount": 100,
    "Items": [
      {
        "Status": "NORMAL",
        "Cycle": "1:Year",
        "StartTimestamp": 1663135741039,
        "SavingsType": "ECS",
        "Utilization": "1.0",
        "PrepayFee": "8760.00",
        "InstanceId": "spn-xxxxxxxx",
        "Currency": "CNY",
        "EndTimestamp": 1663135741039,
        "EndTime": "2021-01-01 00:00:00",
        "StartTime": "2020-01-01 00:00:00",
        "AllocationStatus": "unallocated",
        "InstanceFamily": "ecs.g6",
        "Region": "cn-zhangjiakou-na62-a01",
        "LastBillTotalUsage": "100.0",
        "LastBillUtilization": "0.8",
        "TotalSave": "20.00",
        "PoolValue": "1.00",
        "PayMode": "total",
        "Tags": [
          {
            "Key": "",
            "Value": ""
          }
        ],
        "DeductCycleType": "HOUR",
        "RestPoolValue": "100.0",
        "CommodityCode": "savingplan_common_public_cn",
        "CurrentPoolValue": "100.0"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError message
400InvalidOwnerThe specified owner does not belong to caller.
400InvalidParameterThe specified request contains invalid parameters.
400MissingParameterThe specified request lacks essential parameters.
400NotApplicableThe specified API is not applicable for the user.
400NotApplicableYou are not authorized to call the API operation. Please check whether the caller site matches the API domain regionId.
400NotAuthorizedThe user is not authorized for the specified API.
400NotAuthorizedYou are not authorized to call the API operation. Please check whether RAM user has the permission or check whether ownerId and callerId have been given the appropriate permission.
500InternalErrorAn error occurred in the internal server.

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

Change history

Change timeSummary of changesOperation
2023-07-24The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2023-05-25The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2023-03-27The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2022-12-09The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.