Updated on 2024-11-26 GMT+08:00

Querying Orders

Function

After a customer purchases yearly/monthly resources, it can query the orders in different statuses, such as in the pending approval, processing, canceled, completed, and pending payment statuses.

A partner can log in to Partner Center and follow the instructions described in Viewing a Customer's Orders to view orders of a customer.

If you want to query the resource information of a specified order, invoke this API to obtain the order ID and then invoke the API described in Querying Customer's Yearly/Monthly Resources. Enter the order ID in the request to query the resource information.

Constraints

This API can be invoked using the AK/SK or token of the partner or of the partner's customer. If partner's AK/SK or token is used, the orders of all customers of the partner can be queried.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

GET /v2/orders/customer-orders
Table 1 Query parameters

Parameter

Mandatory

Type

Maximum Length/Value Range

Description

order_id

No

String

A maximum of 64 characters

Order ID. Order IDs are case insensitive.

If this parameter is not included or is left empty, it will not be used as a filter criterion. If it is set to null, it can be used as a filter criterion. This parameter cannot be set to "".

NOTE:

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

customer_id

No

String

A maximum of 64 characters

Customer account ID. To obtain the customer ID, call the API in Querying Customers.

If this parameter is not included, it will not be used as a filter criterion. If it is set to null, it can be used as a filter criterion. This parameter cannot be set to "" or left empty.

create_time_begin

No

String

A maximum of 20 characters

Start time of order creation.

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

The range of HH is 0-23, and the range of mm and ss is 0-59.

The span between the order creation time and end time cannot be more than 1 year.

If this parameter is not included or is left empty, it will not be used as a filter criterion. It cannot be set to "" or null.

create_time_end

No

String

A maximum of 20 characters

End time of order creation.

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

The range of HH is 0-23, and the range of mm and ss is 0-59.

The span between the order creation time and the end time cannot be more than 1 year.

If this parameter is not included or is left empty, it will not be used as a filter criterion. It cannot be set to "" or null.

service_type_code

No

String

A maximum of 64 characters

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. Cloud service type code is case insensitive.

You can call Querying Cloud Service Types to obtain a specific service type.

If this parameter is not included or is left empty, it will not be used as a filter criterion. If this parameter is set to "" or null, it will be used as a filter criterion.

status

No

Integer

-

Order status. The value can be:

  • 1: Pending approval
  • 3: Processing
  • 4: Canceled
  • 5: Completed
  • 6: Pending payment
  • 9: To be confirmed

If this parameter is not included, is left empty, or is set to null, it will not be used as a filter criterion. It cannot be set to "".

order_type

No

String

A maximum of 64 characters

Order type. The value can be:

  • 1: New purchase
  • 2: Renewal
  • 3: Change
  • 4: Unsubscription
  • 10: Yearly/monthly to pay-per-use
  • 11: Pay-per-use to yearly/monthly
  • 13: Trial
  • 14: Commercial use
  • 15: Price adjustment

If this parameter is not included or is left empty, it will not be used as a filter criterion. It cannot be set to "" or null.

limit

No

Integer

1 to 100

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

If this parameter is not included, is left empty, or is set to null, the value 10 is used. This parameter cannot be set to "".

offset

No

Integer

0 to a maximum integer

Offset, which starts from 0. The default value is 0.

If this parameter is not included, is left empty, or is set to null, the value 0 is used. This parameter cannot be set to "".

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.

order_by

No

String

A maximum of 36 characters

Sorting order of the orders. This parameter is case insensitive.

You can sort the orders by creation time.

If you set the value to createTime, the system sorts orders by creation time in ascending order. If you set the value to -createTime, the system sorts orders by creation time in descending order.

If this parameter is not included, is left empty, or is set to "" or null, orders will be sorted by creation time in descending orders.

payment_time_begin

No

String

A maximum of 20 characters

Start time of order payment.

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

The range of HH is 0-23, and the range of mm and ss is 0-59.

The span between the order payment start time and end time cannot be more than 1 year.

If this parameter is not included or is left empty, it will not be used as a filter criterion. It cannot be set to "" or null.

payment_time_end

No

String

A maximum of 20 characters

End time of order payment.

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

The range of HH is 0-23, and the range of mm and ss is 0-59.

The span between the order payment start time and end time cannot be more than 1 year.

If this parameter is not included or is left empty, it will not be used as a filter criterion. It cannot be set to "" or null.

indirect_partner_id

No

String

A maximum of 64 characters

Reseller ID. For details about how to obtain such IDs, see Query Huawei Cloud Resellers.

If a distributor needs to query orders of their resellers' customers, this parameter must be included. If it is not included, orders of the distributor's customers will be returned.

If this parameter is not included or is left empty, it will not be used as a filter criterion. If this parameter is set to "" or null, it will be used as a filter criterion.

method

No

String

A maximum of 64 characters

Query method.

  • oneself: Query your own orders.
  • sub_customer: Query customer orders that are paid for by you.

If this parameter is not included in the request parameters, is set to "", or is set to null, the default value oneself is used.

Request

Request Parameters

None

Example Request

GET https://bss-intl.myhuaweicloud.com/v2/orders/customer-orders?order_id=CS1905251035OA1AF&customer_id=c9e731c4663646988ef4cdb3122837b6&create_time_begin=2020-05-06T08:05:01Z&create_time_end=2020-05-07T08:05:01Z&service_type_code=hws.service.type.obs&status=5&order_type=1&limit=10&offset=0&order_by=-createTime&payment_time_begin=2020-05-06T08:05:01Z&payment_time_end=2020-05-07T08:05:01Z&indirect_partner_id=646988ef4cdb3122834feswrygfd HTTP/1.1
Content-Type: application/json
X-Auth-Token: MIIPAgYJKoZIhvcNAQcCo...ggg1BBIINPXsidG9rZ

Response

Response Parameters

Parameter

Type

Maximum Length/Value Range

Description

error_code

String

A maximum of 20 characters

Status code.

For details, see Returned Values.

error_msg

String

A maximum of 2,000 characters

Error description.

total_count

Integer

An integer greater than or equal to 0

An integer greater than or equal to 0.

Number of records that match the query conditions.

order_infos

List<CustomerOrderV2>

-

Order details.

For details, see Table 2.

Table 2 CustomerOrderV2

Parameter

Type

Maximum Length

Description

order_id

String

A maximum of 64 characters

Order ID

customer_id

String

A maximum of 64 characters

Customer account ID.

service_type_code

String

A maximum of 64 characters

Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs.

service_type_name

String

A maximum of 200 characters

Cloud service type. For example, the cloud service type of ECS is Elastic Cloud Server.

source_type

Integer

-

Customer order source type. The value can be:

  • 1. Customer
  • 2. Agent
  • 3: Contract
  • 4: Distributor

status

Integer

-

Order status. The value can be:

  • 1: Pending approval
  • 2: Pending refund
  • 3: Processing
  • 4: Canceled
  • 5: Completed
  • 6: Pending payment
  • 9: To be confirmed
  • 10: To be shipped
  • 11: To be received
  • 12: Pending pick-up
  • 13: Exchange in progress

order_type

Integer

-

Order type. The value can be:

  • 1: New purchase
  • 2: Renewal
  • 3: Change
  • 4: Unsubscription
  • 10: Yearly/monthly to pay-per-use
  • 11: Pay-per-use to yearly/monthly
  • 13: Trial
  • 14: Commercial use
  • 15: Price adjustment

official_amount

Double

-

Order amount (list price).

In the unsubscription order, this amount equals the value of amount_after_discount.

amount_after_discount

Double

-

Order amount after a discount (excluding the vouchers or cards).

measure_id

Integer

-

Order amount unit.

  • 1: 1 Yuan/Dollar

create_time

String

A maximum of 20 characters

Creation time.

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

The range of HH is 0-23, and the range of mm and ss is 0-59.

payment_time

String

A maximum of 20 characters

Payment time.

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

The range of HH is 0-23, and the range of mm and ss is 0-59.

currency

String

A maximum of 4 characters

Currency code.

contract_id

String

A maximum of 64 characters

Contract ID.

amount_info

AmountInfoV2 Object

-

Order details

For details, see Table 3.

enterprise_projects

List<EnterpriseProject>

-

Enterprise project details of a customer order.

For details, see Table 5.

NOTE:

You can query enterprise project information for each order in batch unsubscription and renewal scenarios by order ID.

Table 3 AmountInfoV2

Parameter

Type

Maximum Length

Description

discounts

List<DiscountItemV2>

-

Item

For details, see Table 4.

flexipurchase_coupon_amount

Double

-

Flexi-purchase coupon amount (reserved).

coupon_amount

Double

-

Cash coupon amount.

stored_card_amount

Double

-

Stored-value card amount (reserved).

commission_amount

Double

-

Handling fee (only for unsubscription orders).

consumed_amount

Double

-

Consumptions (only for unsubscription orders).

Table 4 DiscountItemV2

Parameter

Type

Maximum Length

Description

discount_type

String

A maximum of 8 characters

Discount type.

  • 200: Promotion product discount
  • 300: Promotion discount coupon
  • 301: Promotion coupon
  • 302: Promotion flexi-purchase coupon
  • 500: Specified discount for agent subscription
  • 501: Specified exemption for agent subscription
  • 502: Specified buy-it-now price for agent subscription
  • 600: Discount specified in the discount and rebate contract
  • 601: Discount specified in the channel frame contract
  • 602: Discount specified in the designated-purpose fund contract
  • 603: Discount specified in the directly signed offline contract
  • 604: Discount specified in the authorized telemarketing contract
  • 605: Discount specified in the commercial contract
  • 606: Discount specified in the channel commercial contract
  • 607: Partner authorized discount
  • 609: Discount for order price adjusting
  • 610: Discount amount
  • 700: Promotion discount
  • 800: Top-up account discount

discount_amount

Double

-

Discounted amount.

Table 5 EnterpriseProject

Parameter

Type

Maximum Length

Description

id

String

A maximum of 256 characters

Enterprise project ID.

name

String

A maximum of 256 characters

Enterprise project name.

Example Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: length
Date: response time  
{
    "total_count": 1,
    "order_infos": [
        {
            "order_id": "CS2405161952CE7IU5QmodifyJobAndPartFailJob",
            "customer_id": "0c7fd9bdfb80d4170fb1c0056128d420",
            "service_type_code": "hws.service.type.ec2",
            "service_type_name": "Elastic Cloud Server"
            "source_type": 1,
            "status": 5,
            "order_type": 1,
            "amount_after_discount": 274.6,
            "official_amount": 349.5,
            "measure_id": 1,
            "create_time": "2024-05-16T11:52:10Z",
            "payment_time": "2024-05-16T12:18:35Z",
            "currency": "USD",
            "contract_id": null,
            "amount_info": {
                "discounts": [
                    {
                        "discount_type": "700",
                        "discount_amount": 69.9
                    },
                    {
                        "discount_type": "301",
                        "discount_amount": 5.0
                    }
                ],
                "flexipurchase_coupon_amount": 0.0,
                "coupon_amount": 5.0,
                "stored_card_amount": 0.0,
                "commission_amount": null,
                "consumed_amount": null
            },
            "enterprise_projects": [
                {
                    "id": "0",
                    "name": "default"
                }
            ]
        }
    ]
}

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.

400

CBC.0101

Invalid parameter.

400

CBC.99000037

You do not have the permission to operate this reseller.

403

CBC.0155

Request denied.

The possible causes are as follows: The account authentication information is incorrect. The account or member account does not have the permission to call the API.

500

CBC.0999

Other errors.