Order-Products-Account-Modify
Revision as of 06:59, 3 April 2014
Contents
|
Set and modify an account on a later step when ordering products and services
This example provides the steps to set order's account on a later step and modify it afterward.
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/000001452259ee0103d4e652007f000000010001 Set-Cookie : OwnerId=d0977ed2-86e7-4101-adfe-2675ba0e26ac; Path=/ { "orderId": "000001452259ee0103d4e652007f000000010001", "links": [ {"href": "https://api.hostway.com/orders/", "rel": "self"}, {"href": "https://api.hostway.com/orders/000001452259ee0103d4e652007f000000010001", "rel": "item"} ] }
Add a product
Use POST /orders/{order_id}/account/products to add a product
Request
POST /orders/000001452259ee0103d4e652007f000000010001/account/products Content-Type: application/json; charset=UTF-8 { "offering": "https://api.hostway.com/productSpecifications/core.plangroup.dedserver.plan4/offerings/USD-1" }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/000001452259ee0103d4e652007f000000010001/account/products/00000145225a87f17bd8d66d007f000000010001/ { "url": "https://api.hostway.com/orders/000001452259ee0103d4e652007f000000010001/account/products/00000145225a87f17bd8d66d007f000000010001/" }
Add a service to the product with no attributes
Use POST /orders/{order_id}/account/products/{productId}/services to add a product's service
Request
POST /orders/000001452259ee0103d4e652007f000000010001/account/products/00000145225a87f17bd8d66d007f000000010001/services Content-Type: application/json; charset=UTF-8 { "name": "test123.com", "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.dedserver", "billingCycle": 1 }
Response
201 Created Content-Type: application/json; charset=UTF-8 Location : https://api.hostway.com/orders/000001452292557b24c2acc0007f000000010001/account/products/0000014522925d3222f0ce5b007f000000010001/services/0000014522926e5b266b61ad007f000000010001/ { "url": "https://api.hostway.com/orders/000001452292557b24c2acc0007f000000010001/account/products/0000014522925d3222f0ce5b007f000000010001/services/0000014522926e5b266b61ad007f000000010001/" }
Set an existing account for the order
Use PUT /orders/{order_id}/account to assign an existing account to the order
Request
PUT /orders/000001452292557b24c2acc0007f000000010001/account Content-Type: application/json; charset=UTF-8 { "accountNumber": "test793347" }
Response
204 No Content
Set some account attributes
Use PUT /orders/{orderId}/account/attributes to set the account attributes in an order.
Request
PUT /orders/0000014522fbfd383c2b1a33007f000000010001/account/attributes Content-Type: application/json; charset=UTF-8 [ { "name":"partner_account_id", "value":"paccid_030414051600" } ]
Response
204 No Content
Set modified regular contact
Use PUT /orders/{orderId}/account/contactInfo/{contactType} to set the account contact details for a given contact type in an order.
Request
PUT /orders/0000014522fbfd383c2b1a33007f000000010001/account/contactInfo/regular Content-Type: application/json; charset=UTF-8 { "name": { "firstName": "Test-Regular", "lastName": "Contact", "company": "MyCompany" }, "address": { "street1": "111 My Street", "street2": "street2", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" }, "contactMedia": { "phone1": "312-555-1111", "phone2": "312-555-222", "fax": "312-555-1111", "email1": "myemail@something.com", "email1Format": "html" } }
Set account payment info
Use PUT /orders/{orderId}/account/paymentInfo to set the account's payment info.
Request
PUT /orders/0000014522fbfd383c2b1a33007f000000010001/account/paymentInfo Content-Type: application/json; charset=UTF-8 { "paymentInfoType": "credit_card", "creditCardType": "visa", "accountNumber": "1234567890123456", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "503", "billingAddress": { "street1": "My street", "street2": "", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
204 No Content
Response
204 No Content
Submit the order
Use POST /orders/{order_id}/action to submit the order and to invoke the ordered product provisioning.
Request
POST /orders/000001452292557b24c2acc0007f000000010001/action Content-Type: application/json; charset=UTF-8 { "action": "submit" }
Response
202 Accepted
See also