Orders-orderId-account-products-productId-services:POST
From Hostway API Documentation
Revision as of 11:48, 20 August 2014 by Mike.robski (Talk | contribs)
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. See Service Attributes Structure.
Validation Rules
- The service specification URL ( https://api.hostway.com/serviceSpecifications/{serviceSpecificationId} ) should point to an existing service.
- Each service URL ( https://api.hostway.com/orders/{orderId}/account/products/{productId}/services/{serviceId} ) from the related services list should point to a valid service already added to the product.
- The service billing cycle should be allowed for the product.
- The product should support adding the service.
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.
- 409 Conflict
- A conflict has occurred preventing attributes creation to particular service. There are different conflict situations for different products/services
- Domain-dependent services
- One of the domains to be ordered is already owned by another account or is blacklisted.
- Email domain alias service
- A domain alias would produce impossible to delivery loops namely:
- - There is an email forwarder from the target domain name to a mailbox of the domain alias with the same username, OR
- - There is an email forwarder from the domain alias to a mailbox of the target domain name with the same username
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