Querying Customer's Yearly/Monthly Resources
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.
- If a parameter is set to null, is set to an empty JSON array, or is set to "", the specified number of resources of the current account will be returned. The number of resources is specified by the limit parameter, and the default value is 10.
Debugging
You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.
URI
POST /v2/orders/suscriptions/resources/query
Request
Request Parameters
Parameter |
Mandatory |
Type |
Value Range |
Description |
---|---|---|---|---|
resource_ids |
No |
list<String> |
[0-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 used at the same time. If this parameter is not included in the request parameters, is left empty, or is set to null, it cannot be used as a filter criterion. Records that meet other search criteria are returned.
NOTE:
A resource ID is allocated by a cloud service after the resource is provisioned, such as server_id for ECS. |
order_id |
No |
String |
A maximum of 64 characters |
Order ID. This parameter can be used for querying the resources in a specified order. If this parameter is not included in the request parameters, is set to "", or is set to null, it cannot be used as a filter criterion. Records that meet other search criteria are returned.
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.
The default value is 0. If this parameter is not included in the request parameters or is set to null, the default value 0 is used.
NOTE:
A primary resource takes the primary position in the associated resources.
|
status_list |
No |
list<Integer> |
[0-10] |
Resource status. Queries resources in a specified status. If there are multiple statuses, separate them using commas (,).
If this parameter is not included in the request parameters, is left empty, or is set to null, it cannot be used as a filter criterion. Resources in all statuses are returned. |
offset |
No |
Integer |
0 to 2147483646 |
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, if there are 10 records that meet query conditions, when you set limit to 10 and offset to 1, the second to the tenth records are returned. If there are 20 records that meet query conditions, when you set offset to 0 and limit to 10 for the first page and set offset to 10 and limit to 10 for the second page, then each page will respectively have 10 records. |
limit |
No |
Integer |
1 to 500 |
Number of records queried each time. The default value is 10. |
expire_time_begin |
No |
String |
20 |
Start time of a period during which there are expired resources. The time is in the UTC format yyyy-MM-dd'T'HH:mm:ss'Z', for example, 2019-05-06T08:05:01Z. The range of HH is 0-23, and the range of mm and ss is 0-59. If this parameter is not included in the request parameters, is set to "", or is set to null, it cannot be used as a filter criterion. Records that meet other search criteria are returned. |
expire_time_end |
No |
String |
20 |
End time of a period during which there are expired resources. The time is in the UTC format yyyy-MM-dd'T'HH:mm:ss'Z', for example, 2019-05-06T08:05:01Z. The range of HH is 0-23, and the range of mm and ss is 0-59. If this parameter is not included in the request parameters, is set to "", or is set to null, it cannot be used as a filter criterion. Records that meet other search criteria are returned. |
service_type_code |
No |
String |
64 |
Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. You can call the Querying Cloud Service Types API to query the type of a cloud service. If this parameter is not included or is set to null, it will not be used as a filter criterion. This parameter cannot be set to an empty string. There will be parameter verification. |
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", "service_type_code": "hws.service.type.obs" }
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 |
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, ap-southeast-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. |
resource_type_code |
String |
Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. |
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). |
service_type_name |
String |
Cloud service type. For example, the cloud service type of ECS is Elastic Cloud Server. |
resource_type_name |
String |
Resource type. For example, the resource type of ECS is Cloud Host. |
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.
|
status |
Integer |
Resource status.
|
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.
NOTE:
Only 3 indicates that the resource is automatically renewed. In other cases, the expiration policy for non-automatic renewal is used. |
product_spec_desc |
String |
A maximum of 512 characters allowed. Product specification description. |
spec_size |
BigDecimal |
Product size, which is available only for linear products.
NOTE:
Linear products are those whose size must be specified during a subscription. For example, you can select 10 GB or 20 GB during a disk subscription. |
spec_size_measure_id |
Integer |
Product size unit, which is available only for linear products. Call the API in Querying Measurement Units to obtain the value. |
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": "ap-southeast-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, "product_spec_desc": "Ultra-high I/O | 40.0 GB", "spec_size": 40.0, "spec_size_measure_id": 17 } ], "total_count": 1 }
Returned Values
- 4xx: This class of HTTP status code is intended for situations in which the error seems to have been caused by the client, for example, the request contains bad syntax or incorrect parameters. You must ensure the request is correct.
- 5xx: This class of HTTP status code is intended for cases in which the Huawei Cloud server is aware that it has encountered an error or is otherwise incapable of performing the request. In this case, contact Huawei Cloud customer service.
HTTP Value |
Error Code |
Description |
---|---|---|
400 |
CBC.0100 |
Parameter error. |
403 |
CBC.0151 |
Access denied. |
500 |
CBC.0999 |
Other errors. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot