Order-webs-planet
Contents |
Order a new WebsPlanet
This example provides the steps to order a new webs planet product through the Hostway Ordering API.
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 acout for the order
Use PUT /orders/{order_id}/account to create an account or add an existing one to the order.
Request
PUT /orders/00000143d407b34742ee26ae007f000000010001/account Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ { "currency": "USD", "language": "en-US" }
Response
204 No Content
Add a Websplanet product to the order
The websplanet product specification offerings can be determined using the Hostway Product Catalog API. Then add a new websplanet 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.linux.webstart/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 Webhosting service to the new product
A Websplanet service needs to be related to either a Windows or a Linux webhosting service. To do that, the webhosting service needs to be created first.
Request
POST /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ {"name": "Websplanet", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.webhosting.linux.5GB", "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 the Webhosting service attributes
PUT /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407b34742ed9lker8007f000000010001/attributes Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ {"domain": "ng-test-fitnesse-websplanet-20140505-0505.us"}
Add a Websplanet service to the new product
Please note that WebsPlanet can be added only as a child service to the webhosting service. You have to specify webhosting service you want websplanet to be added to.
Assuming you have a webhosting service in your order, you can add websplanet using POST /orders/{order_id}/account/products/{product_id}/services. The "relatedTo" attribute should contain the webhosting 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": "Websplanet", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.websplanet.1", "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 the WebsPlanet service attributes
PUT /orders/00000143d407b34742ee26ae007f000000010001/account/products/00000143d407b725d9eb9a41007f000000010001/services/00000143d407bea7e2b84d37001f000000010001/attributes Content-Type: application/json; charset=UTF-8 Cookie: OwnerId=09185e9b-2ea0-4bef-950e-fc9f8b89861f; Path=/ {"domain": "ng-test-fitnesse-websplanet-20140505-0505.us", "email": "test@example.com"}