Orders-orderId-discounts:PUT
From Hostway API Documentation
Revision as of 06:06, 26 September 2013 by Stanimir.dimitrov (Talk)
PUT /orders/{orderId}/discounts
Set discounts for the entire Order. Discounts that are applied to an entire order will be applied to all of the product and services within the order. Note: This will replace any existing discounts that were configured at the order level.
Contents |
Request
PUT /orders/{orderId}/discounts
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
{ "discounts": [ { "priceName": "recurring", "recurrences": -1, "type": "amount", "value": "1.00" } ] }
Parameters
- discounts - list
- A list of discounts. Each discount contains the following:
- priceName - string
- The type of price to which the discount will be applied.
- Validation: Should match the fee types configured in the back-end.
- Note: Only "recurring" is currently supported
- recurrences - integer
- The number of times that the discount will be applied. A value of "-1" means the discount will be applied every time the fee is charged.
- Validation: Should be either a positive integer or -1.
- Note: Value must be -1 if the priceName is "recurring".
- type - string
- Specifies the discount type which determines the method used to calculate the amount that is discounted. Possible values are:
- amount: Discount will be treated as an exact amount
- percent: Discount will be treated as a percentage
- Validation: Should be set to either amount or percent.
- value - string
- The discount amount. The value will be interpreted based on the specified discount type.
- Validation: Should be a positive number.
Response
Status Code
- 200 OK
- The discount was successfully set.
- 400 BadRequest
- The request body contains invalid parameters
- 401 Unauthorized
- The request was not properly authorized.
- 403 Forbidden
- The client does not have sufficient privileges.
- 404 Not Found
- Returned if the order could not be found.
See also