Order

Order

Order is the entity that handles purchasing of our service plans.

Endpoints Summary

ENDPOINT (CLICK TO READ FULL SPECIFICATION)
METHOD
DESCRIPTION

POST

places an order.

POST

add a cart item. returns the cart item id. Carts items can be added to orders to place

DELETE

deletes the specified cart item

POST

Places a Change order, which is for adding add ons to existing subscriptions.

GET

Calcuates the change order total before placing the change order. Also check if the change order can be placed. This api call does not actually place a change order.

Create Order

Request: POST /order

NAME
TYPE
DESCRIPTION

account

string

(requiried) account id referred to in format of XX-11111111

currency

string

currency of order. only required if account has no currency set . The currency is set when there is a first order placed in your account and cannot be changed. If the account currency is already set, this field is ignored.

label

string

label of cloud server

cartItems

array

payment_type

string

currently, only credit cart payment is accepted, therefore the value of this parameter is ccard.

Create Cart Item

Request: POST /order/add-to-cart

NAME
TYPE
DESCRIPTION

billing_cycle

int

(requiried) 1: monthly, 3: quarterly, 12: annually

plan_id

int

plan_type

string

currrently only cloud_servers_standard(General Purpose Cloud Server), cloud_servers_highmemory (Memory Optimized Cloud Server), cloud_servers_dedicatedcpu (Dedicated CPU Cloud Server), and cloud_servers_highstorage_sas (High Storage Cloud Server) are supported

quantity

int

the quantity of this item to add to cart

addons

array

password

string

password of Cloud Server if the plan_type is cloud_servers_standard, cloud_servers_highmemory, cloud_servers_highstorage, cloud_servers_highfrequency, cloud_servers_dedicatedcpu or cloud_servers_highstorage_sas. This field is not required if the plan_type are other types.

os_template_id

int

custom_ssh_key

string

base64 encoded string of ssh key. Only default linux templates supports custom_ssh_key. Windows and custom templates do not support ssh keys.

custom_script

string

base64 encoded string of custom script to run at provisioning time. Only default linux templates supports custom scripts. Windows and custom templates do not support custom scripts.

Sample Response:

{
    "0": 995,   // cart_item_id
    "data": {
        "message": "Cart Items added successfully",
        "code": 200
    }
}

Delete Cart Item

Request: DELETE /order/cartItems/delete/{cart_item_id} where cart_item_id is the cart item id (obtained from POST /order/add-to-cart api) to be deleted.

Change Order

Request: POST /order/changeorder

NAME
TYPE
DESCRIPTION

subscription_id

int

subscription id

resources

array

Key-value array {resource_name: resource->name, delta_value: value} format. Available resources are vm_backup, china_route, vm_antiddos.

Sample Payload:

{
"subscription_id": 4158,
"resources" : [{"resource_name": "vm_backup", "delta_value":"1"}]

}

Change Order Total

Request: PUT /order/changeorder/total

NAME
TYPE
DESCRIPTION

subscription_id

int

subscription id

resources

array

Key-value array {resource_name: resource->name, delta_value: value} format. Available resources are vm_backup, china_route, vm_antiddos.

The payload is the same as Change Order API above.

Sample Response:

{
    "available": true,
    "total": 19.06,
    "currency": "hkd",
    "date_from": "2020-04-23",
    "date_to": "2020-05-22",
    "inapplicable_resources": []
}

Switch Order

Request: PUT /order/switch/{subscription_id}

NAME
TYPE
DESCRIPTION

plan_id

int

target plan's id. this plan need to have the same type as current plan

Sample Response:

{
    "available":true,
    "total":118.68,
    "currency":"hkd",
    "date_from":"2021-03-09",
    "date_to":"2021-03-28"
}

Switch Order Total

Request: PUT /order/switch/total

NAME
TYPE
DESCRIPTION

subscription_id

int

subscription id

plan_id

int

target plan's id. this plan need to have the same type as current plan

Sample Response:

{
    "available":true,
    "total":118.68,
    "currency":"hkd",
    "date_from":"2021-03-09",
    "date_to":"2021-03-28"
}

Last updated