Orders-orderId-account-products-productId-services:POST

From Hostway API Documentation
Revision as of 13:49, 19 September 2013 by Mike.robski (Talk | contribs)
Jump to: navigation, search

POST /orders/{orderId}/account/products/{productId}/services

Adds a new service to a product in the order.

Contents


Request

POST /orders/{orderId}/account/products/{productId}/services

Request Parameters

orderId - string
The unique order Id. The URI of the order is returned by the POST /orders call.
productId - string
UUID specifying the product

URI Parameters

None.

Request Headers

Content-Type
Required. Set this header to application/json; charset=UTF-8
Cookie
A cookie named OwnerId to identify the client (for most browser clients, the browser will do this automatically, depending on the browser configuration). The value of the cookie would come from the response to the create order request in the Set-Cookie response header.

Request Body

{
  "name": "john.smith1",
  "relatedTo": [ "https://api.hostway.com/orders/{orderId}/account/products/{productId}/services/{serviceId}" ],
  "serviceSpecification": "https://api.hostway.com/serviceSpecifications/{serviceSpecificationId}",
  "billingCycle": 1,
  "attributes": {
    "{attribute-name}": "{attribute-value}",
    ....
  }
}
 

Parameters

name - string
The name of the new service
relatedTo - list
(OPTIONAL)
A list containing other services related in some way to the newly created service. The relatedTo may be omitted, but relationships between some types of services have to be established for the order to be validated or submitted.
serviceSpecification - string
Link to the product catalog specification describing the new service
billingCycle - integer
Billing cycle (length of billing period in months) of the service. Allowed values are from 1 to 120
attributes - dictionary
(OPTIONAL)
a dictionary of the new service's attributes values. Each (attribute-name, attribute-value) pair present the service attribute name and its relevant value to be set. The allowed attribute names depends on the serviceSpecification field value. Some supported service categories:
* Web Hosting
* Domain Name Registration
* Sub-Domain Registration
* Dedicated Server

Response

Status Code

201 Created
The product was successfully added to the order.
400 Bad Request
The request body contains invalid JSON or the values do not adhere to the restrictions set for them.
401 Unauthorized
The OwnerId cookie was not specified or is incorrect.
403 Forbidden
The client does not have permissions to add services.
404 Not Found
An account has not been added to the given order or the order does not exist.

Response Headers

Location
Returned with successful response. Contains the URI of the newly added service.

Response Body

None.

Examples

Create a service with attributes

Request

{
    "name": "ng-test-hwus-test.com",
    "serviceSpecification": "https://api.hostway.com/serviceSpecifications/core.dedserver",
    "billingCycle": 1,
    "attributes": { 
        "serverName": "sampleServerName",
        "serverLocation": "Tampa"
    }
}
 

Response

{
    "url": "https://api.hostway.com/order/account/products/00000140728b013c52e249a4007f000000010001/services/00000140735d43640f62c50f007f000000010001/"
}
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox