Order-vps-virtuozzo
Mike.robski (Talk | contribs) m (1 revision: Release 105) |
Latest revision as of 11:56, 3 April 2015
Order VPS Virtuozzo products and services
This example provides the steps to order a new VPS Virtuozzo product and services through the Hostway OrderAPI.
Create a new order
Use POST /orders to create a new order
Request
POST /orders Content-Type: application/json; charset=UTF-8 {}
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001 Set-Cookie : OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "orderId": "00000143d407b34742ee26ae007f000000010001", "links": [ {"href": "https://api.hostway.com/orders/", "rel": "self"}, {"href": "https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001", "rel": "item"} ] }
Create a new account or add an existing one to the order
Use PUT /orders/{order_id}/account to create an account or add an existing one to the order.
Request for creating a new account
PUT /orders/00000143d407b34742ee26ae007f000000010001/account Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "currency": "USD", "language": "en-US" }
Request for adding an existing account
PUT /orders/00000143d407b34742ee26ae007f000000010001/account Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "accountNumber": "acct123456" }
Response
204 No Content
Add a VPS Virtuozzo product to the order
The VPS Virtuozzo product specification offerings can be determined using the Hostway Product Catalog API. Then add a new VPS Virtuozzo product to the order by using POST /orders/{order_id}/account/products.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "offering": "https://api.hostway.com/productSpecifications/core.plan.vps.virtuozzo.u101/offerings/USD-1" }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001
Add a Virtuozzo Server service to the new product
Virtuozzo Server Windows/Linux service needs to be created first before any other VPS Virtuozzo services(IP, Memory, ControlPanel, Disk, Bandwidth, PowerPack) are added.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.server.u100", "billingCycle": 1 }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001
Add VPS Virtuozzo services to the new product
Please note that VPS Virtuozzo services(IP, Memory, ControlPanel, Disk, Bandwidth) can be added only as a child service to the Virtuozzo Server Windows/Linux service. You have to specify Virtuozzo Server Windows/Linux service you want your VPS Virtuozzo services(IP, Memory, ControlPanel, Disk, Bandwidth) to be added to.
Add VPS Virtuozzo Controlpanel service
Assuming you have already a Virtuozzo Server Windows/Linux service in your order, you can add Virtuozzo Controlpanel service using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the Virtuozzo Server Windows/Linux service's URL.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.controlpanel.plesk9-10domain", "billingCycle": 1, "relatedTo": ["https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001"] }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407bea7e2b84d37001f000000010001
Add VPS Virtuozzo Additional Memory service
Assuming you have already a Virtuozzo Server Windows/Linux service in your order, you can add VPS Virtuozzo Additional Memory service using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the Virtuozzo Server Windows/Linux service's URL.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.additional_memory.256mb", "billingCycle": 1, "relatedTo": ["https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001"] }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000288d407bcc7e2f81d39009f000000010001
Add VPS Virtuozzo Additional Disk Space service
Assuming you have already a Virtuozzo Server Windows/Linux service in your order, you can add VPS Virtuozzo Additional Disk Space service using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the Virtuozzo Server Windows/Linux service's URL.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.additional_disk.10gb", "billingCycle": 1, "relatedTo": ["https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001"] }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000255d407bec6e2c84117001d000000010001
Add VPS Virtuozzo Additional Bandwidth service
Assuming you have already a Virtuozzo Server Windows/Linux service in your order, you can add Virtuozzo Additional Bandwidth service using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the Virtuozzo Server Windows/Linux service's URL.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.additional_bandwidth.1000gb", "billingCycle": 1, "relatedTo": ["https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001"] }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143c2546caa7e2b84d37001f000000010001
Add VPS Virtuozzo IP service
Assuming you have already a Virtuozzo Server Windows/Linux service in your order, you can add Virtuozzo IP service using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the Virtuozzo Server Windows/Linux service's URL.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.ip", "billingCycle": 1, "relatedTo": ["https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001"] }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000453c2547fae902b84d37001d000000010001
Add VPS Virtouzzo PowerPack service
Assuming you have already a Virtuozzo Server Windows/Linux service in your order, you can add VPS Virtouzzo PowerPack service using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the Virtuozzo Server Windows/Linux service's URL.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "name": "VPS Virtuozzo Test", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.vps.virtuozzo.powerpack", "billingCycle": 1, "relatedTo": ["https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001"] }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000199a2947fac902b11d37001d000000010001
Submit the order
Use POST /orders/{order_id}/action to submit the order and invoke the cloud drive provisioning.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/action Content-Type: application/json; charset=UTF-8 { "action": "submit" }
Response
202 Accepted