Orders-orderId-account-products:POST

(Difference between revisions)
Jump to: navigation, search
(Parameters)
m (1 revision: Release 86)

Revision as of 10:59, 11 October 2013

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}",
  "promoCode": "{promoCode}"
}
 

Parameters

offering - string
Link to the product catalog offering specifying the new product.
promoCode - string
A promotion code for the new product promotion codes.

Validation Rules

  1. The product specification URL ( https://api.hostway.com/productSpecifications/{productSpecificationId} ) should point to an existing product.
  2. The product offering currency should match the account currency.
  3. The product offering URL ( https://api.hostway.com/productSpecifications/{productSpecificationId}/offerings/{productOfferingId} ) should point to an existing product offering.
  4. The product use type (public, internal, internal view only, etc.) should be allowed for the current user.
  5. 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


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox