Help Center > > API Reference> Transaction Management> Managing Yearly/Monthly Resources> Querying Customer's Yearly/Monthly Resources

Querying Customer's Yearly/Monthly Resources

Updated at: Dec 20, 2021 GMT+08:00

Function

A customer can query one or all yearly/monthly resources on the partner sales platform.

If you need to renew resources that already take effect after you successfully invoke this API, you can invoke the API described in Querying the Price of a Yearly/Monthly Product to query the price for the yearly/monthly resources and then invoke the API described in Renewing Subscription to Yearly/Monthly Resources to renew the subscription.

Constraints

  • This API can be invoked using the customer AK/SK or token only.
  • This API queries resources successfully provisioned only.

URI

POST /v2/orders/suscriptions/resources/query

Request

Request Parameters

Table 1 Request parameters

Parameter

Mandatory

Type

Value Range

Description

resource_ids

No

list<String>

Maximum value: 50

Resource IDs.

Queries resources with the specified resource IDs. When only_main_resource is 0, the system queries the specified resources and their auxiliary resources. A maximum of 50 IDs can be queried at the same time. Use commas (,) to separate multiple IDs.

NOTE:

A resource ID is allocated by a cloud service after the resource is provisioned, such as server_id in ECS.

order_id

No

String

A maximum 64 characters

Order ID. This parameter can be used for querying the resources in a specified order.

NOTE:

When special characters are used for query, perform the URL code conversion. For example, % should be converted to %25.

only_main_resource

No

Integer

0, 1

Whether to query only the primary resources. This parameter is invalid when resource_ids are IDs of attached resources. In this case, the system queries the attached resources.

  • 0: Queries both the primary resources and attached resources.
  • 1: Queries only the primary resources.

The default value is 0.

NOTE:

A primary resource takes the primary position in the associated resources.

  • For ECS, ECS is the primary resource, and EVS is the attached resource.
  • For VPC, if the shared bandwidth is used, the bandwidth is the primary resource, and EIPs are the attached resource. If the exclusive bandwidth is used, EIPs are the primary resources, and the bandwidth is the attached resource.

status_list

No

list<Integer>

Maximum value: 10

Resource status.

Queries resources in a specified status. If there are multiple statuses, separate them using commas (,).

  • 2: Provisioned
  • 4: Frozen
  • 5: Expired

offset

No

Integer

0 to maximum integer

Offset, starting from 0. The default value is 0.

NOTE:

This parameter is used for pagination. Retain its default value 0 if pagination is not required. offset indicates the offset relative to the first data record among all that meets the conditions configured. If you set offset to 1, the second and subsequent data records are returned.

For example, there are 10 data records, and if you set limit to 10 and offset to 1, the second to the tenth data records are returned.

limit

No

Integer

1 to 500

Number of records queried each time. The default value is 10.

expire_time_begin

No

String

20

Used to query the list of expired resources in a specified period. The value is in UTC format.

expire_time_end

No

String

20

Used to query the list of expired resources in a specified period. The value is in UTC format.

Example Request

POST https://bss-intl.myhuaweicloud.com/v2/orders/suscriptions/resources/query HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ
{
    "resource_ids":[
        "0A063A********BC8548E65D0089A905"
    ],
    "order_id":"CS1905251035OA***",
    "only_main_resource":1,
    "status_list":[
        2
    ],
    "offset":0,
    "limit":10,
    "expire_time_begin":"2021-09-01T08:05:01Z",
    "expire_time_end":"2021-09-03T08:05:01Z"
}

Response

Response Parameters

Parameter

Type

Description

error_code

String

Error code.

For details, see Returned Values.

error_msg

String

Error description.

data

List<OrderInstanceV2>

Resource list.

For details, see Table 2.

total_count

Integer

Total number of records

Table 2 OrderInstanceV2

Parameter

Type

Description

id

String

Internal ID of the resource to be provisioned. The ID generated after the resource is provisioned is resource_id.

resource_id

String

Resource ID.

resource_name

String

Resource instance name.

region_code

String

Cloud service region code, for example, cn-north-1. Obtain the value from the Region column in Regions and Endpoints.

service_type_code

String

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

resource_type_code

String

Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. To obtain a specific resource type, call the API in Querying Resource Types.

resource_spec_code

String

Specification of a cloud service resource. For example, a VM resource specification is s2.small.1.linux (.win or .linux should be added at the end of the specification).

project_id

String

Resource project ID.

product_id

String

Product ID.

parent_resource_id

String

Parent resource ID

is_main_resource

Integer

Primary resource or not.

  • 0: Attached resource
  • 1: Primary resource

status

Integer

Resource status.

  • 2: Provisioned
  • 3: Closed (not visible to customers)
  • 4: Frozen
  • 5: Expired

effective_time

String

Effective time of a resource.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, such as 2019-05-06T08:05:01Z

expire_time

String

Expiration time of a resource.

UTC time in "yyyy-MM-dd'T'HH:mm:ss'Z'" format, such as 2019-05-06T08:05:01Z

expire_policy

Integer

Billing policy after a resource expires.

  • 0: Entering the grace period upon expiration
  • 1: Yearly/monthly to pay-per-use
  • 2: Automatically deleted upon expiration (directly deleted from resources that take effect)
  • 3: Automatically renewed upon expiration
  • 4: Automatically frozen upon expiration
  • 5: Automatically deleted upon expiration (deleted from resources in the retention period)
NOTE:

Only 3 indicates that the resource is automatically renewed. In other cases, the expiration policy for non-automatic renewal is used.

Example Response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time
{
  "data": [
  {
     "id": "01154-54600027-0",
     "resource_id": "0A063A11905F42BC8548E65D0089A905",
     "resource_name": "0A063A11905F42BC8548E65D0089A905name",
     "region_code": "cn-south-1",
     "service_type_code": "hws.service.type.ebs",
     "resource_type_code": "hws.resource.type.volume",
     "resource_spec_code": "SSD",
     "project_id": "1dd89a5fe99e4cca80edca61e737477a",
     "product_id": "2fd338aca5ae4a01aac81deaa900e441",
     "parent_resource_id": "9ad02e1ad3394d1bb3da48890fbc4c06",
     "is_main_resource": 1,
     "status": 2,
     "effective_time": "2020-05-03T09:11:10Z",
     "expire_time": "2020-06-03T09:11:10Z",
     "expire_policy": 0
    }
   ],
  "total_count": 1
}

Returned Values

HTTP Value

Error Code

Description

400

CBC.0100

Parameter error.

403

CBC.0151

Access denied.

500

CBC.0999

Other errors.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel