Orders-orderId-account-products-productId-services-serviceId-promotion:PUT

From Hostway API Documentation
Jump to: navigation, search

PUT /orders/{orderId}/account/products/{productId}/services/{serviceId}/promotion

Set promotion code for a service in an order.

Contents


Request

PUT /orders/{orderId}/account/products/{productId}/services/{serviceId}/promotion

URI 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
serviceId - string
UUID specifying the service for which actions are to be performed

Query String 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

{
  "promoCode": "{promoCode}"
}
 

Request Body Parameters

promoCode - string (Required)
A promotion code to be applied to the service fees when retrieving the quote.

Response

Status Code

Status Code Error Message Description
204 No Content - The operation was successfully completed.
400 Bad Request POST data error promoCode was not provided.
401 Unauthorized - No owner Id specified or the specified owner is not authorized to add the promotion code.
Only authenticated users may access the order, and no authentication header provided for the current request.
404 Not Found Resource not found Order does not exist.
Product or service does not exist.
502 Bad Gateway - Unexpected backend response. Cannot apply promotion code.

Example

Successfully add a promotion code for service

Request

PUT /orders/{orderId}/account/products/{product_id}/services/{serviceId}/promotion
Cookie: OwnerId={owner_id}; Path=/

{
  "promoCode": "ThanksgivingPriceDrop"
}

Response

204 No Content

Missing promoCode field

Request

PUT /orders/{orderId}/account/products/{product_id}/services/{serviceId}/promotion
Cookie: OwnerId={owner_id}; Path=/

{
  "code": "ThanksgivingPriceDrop"
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "{guid}",
    "message": "Resource not found",
    "code": 400,
    "details": {
      "promoCode": "Required"
    }
  }
}

No authorization

Request

PUT /orders/{orderId}/account/products/{product_id}/services/{serviceId}/promotion
Cookie: OwnerId={wrong_owner_id}; Path=/

{
  "promoCode": "ThanksgivingPriceDrop"
}

Response

401 Unauthorized
Content-Type : text/plain; charset=UTF-8

401 Unauthorized

This server could not verify that you are authorized to access the document you requested.
Either you supplied the wrong credentials (e.g., bad password),
or your browser does not understand how to supply the credentials required.

Order does not exist

Request

PUT /orders/{non-existing_orderId}/account/products/{product_id}/services/{serviceId}/promotion
Cookie: OwnerId={owner_id}; Path=/

{
  "promoCode": "ThanksgivingPriceDrop"
}

Response

404 Not found
Content-Type : application/json; charset=UTF-8

{
  "itemNotFound": {
    "guid": "{guid}",
    "message": "Resource not found",
    "code": 404,
    "details": ""
  }
}


See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox