Updated on 2026-02-05 GMT+08:00

Updating a Resource

Function

This API is used to update a subscribed resource.

Calling Method

For details, see Calling APIs.

URI

PUT /v1/{project_id}/subscriptions/orders

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. You can call the IAM API to obtain a user token. The value of X-Subject-Token in the response header is the user token.

X-Language

Yes

String

Current language.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

scene

Yes

String

Operation scenario. PREPAID: yearly/monthly billing; POSTPAID: pay-per-use billing.

operate_type

Yes

String

Operation type in the pay-per-use or yearly/monthly scenario.

For example, you want to increase or decrease the quota, upgrade or downgrade the specifications, and change the billing mode from pay-per-use to yearly/monthly.

UPGRADE: upgrading the specifications; ADDITION: increasing the quota. DECREASE: decreasing the quota. POSTPAID_2_PREPAID: changing from pay-per-use to yearly/monthly billing.

Note: Currently, specification scale-down is not supported. For example, you cannot change the service from the professional edition to the standard or basic edition.

promotion_info

No

String

Promotion discount information.

tag_list

No

Array of SubscriptionTag objects

Billing tag.

product_list

No

Array of UpdateProduct objects

List of products to be changed.

Table 4 SubscriptionTag

Parameter

Mandatory

Type

Description

key

No

String

Key.

A maximum of 36 characters are allowed. Only letters, digits, hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF) are allowed.

value

No

String

Value. A maximum of 43 characters are allowed. The value can be an empty string. The character set is as follows: A-Z, a-z, 0-9, periods (.), hyphens (-), underscores (_), and Unicode characters (\u4E00-\u9FFF).

Table 5 UpdateProduct

Parameter

Mandatory

Type

Description

resource_type

No

String

Resource type after the change.

resource_spec_code

Yes

String

Flavor after the modification.

resource_size

No

Integer

Resource quota after the change.

If **operate_type **is set to addition, the value of resource_size must be greater than that of resource_id. If operate_type is set to decrease, the value of resource_size must be less than that of resource_id and greater than or equal to the number of ECSs in the current project.

resource_id

Yes

String

Resource ID to be changed.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

order_id

String

ID of the order for creating or changing a resource. This parameter is returned only when scene is set to PREPAID.

order_status

Integer

Order update status. 1: The order is changed successfully. 5: The order fails to be changed.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error description.

Range

N/A

Example Requests

  • Upgrade the yearly/monthly basic edition to the professional edition (assuming that the historical version is the basic edition).

    {
      "scene" : "PREPAID",
      "operate_type" : "UPGRADE",
      "product_list" : [ {
        "resource_type" : "xxx.resource.type.secmaster.typical",
        "resource_spec_code" : "secmaster.professional",
        "resource_size" : 3,
        "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b"
      } ],
      "tag_list" : [ {
        "key" : "testKey3",
        "value" : "testVal3"
      } ]
    }
  • Increase the pay-per-use resource quota.

    {
      "scene" : "POSTPAID",
      "operate_type" : "ADDITION",
      "product_list" : [ {
        "resource_type" : "xxx.resource.type.secmaster.typical",
        "resource_spec_code" : "secmaster.professional",
        "resource_size" : 3,
        "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b"
      } ],
      "tag_list" : [ {
        "key" : "testKey3",
        "value" : "testVal3"
      } ]
    }
  • Reduce the pay-per-use resource quota.

    {
      "scene" : "POSTPAID",
      "operate_type" : "DECREASE",
      "product_list" : [ {
        "resource_type" : "xxx.resource.type.secmaster.typical",
        "resource_spec_code" : "secmaster.professional",
        "resource_size" : 2,
        "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b"
      } ],
      "tag_list" : [ {
        "key" : "testKey3",
        "value" : "testVal3"
      } ]
    }
  • Change the billing mode from pay-per-use to yearly/monthly.

    {
      "scene" : "POSTPAID",
      "operate_type" : "POSTPAID_2_PREPAID",
      "product_list" : [ {
        "resource_spec_code" : "secmaster.professional",
        "resource_id" : "e6d9047a-3478-4867-8c0d-7c4cfed1685b"
      } ]
    }

Example Responses

Status code: 200

Request succeeded.

{
  "order_id" : "CS2510212051NLDL4",
  "order_status" : 1
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Request parameter error.

403

Insufficient permissions.

404

Resources are not found.

Error Codes

See Error Codes.