Orders-orderId-account-products:POST
From Hostway API Documentation
Revision as of 15:31, 27 September 2013 by Mike.robski (Talk | contribs)
POST /orders/{orderId}/account/products
Adds a new Product to the Account's Order.
If, at the time the product is created, there is not yet an Account in the order, then this call will implicitly add a very rudimentary Account (containing only a default language & the currency of this product).
If there is already an Account in the order at the time this call is made, the currency of the specified product offering *must* match the currency of the Account.
Contents |
Request
POST /orders/{orderId}/account/products
Request Parameters
- orderId - string
- The unique order Id. The URI of the order is returned by the POST /orders call.
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
{ "offering": "https://api.hostway.com/productSpecifications/{productSpecificationId}/offerings/{productOfferingId}" }
Parameters
- offering - string
- Link to the product catalog offering specifying the new product.
Validation Rules
- The product specification URL ( https://api.hostway.com/productSpecifications/{productSpecificationId} ) should point to an existing product.
- The product offering currency should match the account currency.
- The product offering URL ( https://api.hostway.com/productSpecifications/{productSpecificationId}/offerings/{productOfferingId} ) should point to an existing product offering.
- The product use type (public, internal, internal view only, etc.) should be allowed for the current user.
- The product offering should be valid according to the back-end.
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 products.
- 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 product.
Response Body
None.
See also