Orders-orderId-account-products-productId-services-serviceId-discounts:PUT
From Hostway API Documentation
Revision as of 05:15, 6 August 2014 by Vladimir.georgiev (Talk)
PUT /orders/{orderId}/account/products/{productId}/services/{serviceId}/discounts
Set discounts for the specified service. Note: This will replace any existing discounts that were configured for the specified service.
Contents |
Request
PUT /orders/{orderId}/account/products/{productId}/services/{serviceId}/discounts
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 for which actions are to be performed
- serviceId - string
- UUID specifying the service for which actions are to be performed
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
Body for adding an indefinite discount of 1 dollar for the recurring fee for the service:
{ "discounts": [ { "priceName": "recurring", "recurrences": -1, "type": "amount", "value": 1.00 } ] }
Body for adding a 1 dollar amount discount for the first cycle for a domain registration fee:
{ "discounts": [ { "priceName": "domain_registration_fee", "recurrences": 1, "type": "amount", "value": 1.00 } ] }
Body for adding a 10% discount for the first three monthly cycles for a service's recurring fee:
{ "discounts": [ { "priceName": "recurring", "recurrences": 3, "type": "percent", "value": 0.1 } ] }
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 (eg. 'recurring', 'domain_registration_fee', 'setup_fee' etc.) and should be configured for the corresponding franchise.
- 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.
- 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