Orders-orderId-account-products-productId-services-serviceId-discounts:GET

From Hostway API Documentation
Jump to: navigation, search

GET /orders/{orderId}/account/products/{productId}/services/{serviceId}/discounts

Get discounts that were added at the Service level.

Contents


Request

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

URI Parameters

None.

Request Headers

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.

Response

Status Code

Status Code Error Message Description
200 OK - The request was executed successfully.
401 Unauthorized - The request was not properly authorized.
403 Forbidden Unauthorized: DiscountsView failed permission check The client does not have sufficient privileges.
404 Not Found Resource not found Order does not exist.
Product could not be found in this order.
Service could not be found for this product.
502 Bad Gateway - Failed to retrieve service discount info.

Response Body

{
  "discounts": [
    {
      "priceName": "recurring",
      "recurrences": -1,
      "type": "amount",
      "value": "1.00"
    }
  ],
  "links": [
    {
      "href": "https://api.hostway.com/orders/{orderId}/account/product/{productId}/services/{serviceId}/discounts",
      "rel": "self"
    }
  ]
}
 

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.
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.
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.
value - string
The discount amount. The value will be interpreted based on the specified discount type.
links - list
Hypermedia for this resource. Links to self.


Example

Success

Request

GET /orders/{orderId}/account/products/{productId}/services/{serviceId}/discounts
Authorization: Basic dGVzdC52cGxleEBjb3JwX2xkYXBfc2VydmljZV9jaGk6VHJAcXNQODch
Cookie: OwnerId={owner_id}; Path=/

Response

200 OK
Content-Type : application/json; charset=UTF-8

{
  "discounts" : [ {
    "priceName" : "recurring",
    "type" : "amount",
    "value" : "5.00",
    "recurrences" : -1
  } ],
  "links" : [ {
    "href" : "https://api.hostway.com/orders/0000014859b641999db63a3d007f000000010001/account/products/0000014859b8411671c04a92007f000000010001/
services/0000014859b88f1f066e3a67007f000000010001/discounts/",
    "rel" : "self"
  } ]
}

Missing authorization

Request

GET /orders/{orderId}/account/products/{productId}/services/{serviceId}/discounts
Cookie: OwnerId={owner_id}; Path=/

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.

Insuffucient privileges

Request

GET /orders/{orderId}/account/products/{productId}/services/{serviceId}/discounts
Authorization: Basic ZWdjUlBtZWZiWnJVQHNpdGVjb250cm9sX2hvc3R3YXlfdXNfbWFpbjpTdnVROGlWOUFTVTc0
Cookie: OwnerId={owner_id}; Path=/

Response

403 Forbidden
Content-Type : application/json; charset=UTF-8

{
  "forbidden": {
    "guid": "b5b513b8-8436-4eee-b49e-ac1d369a9d1b",
    "message": "Unauthorized: DiscountsView failed permission check",
    "code": 403,
    "details": ""
  }
}

Order does not exist

Request

GET /orders/{non-existent_orderId}/account/products/{productId}/services/{serviceId}/discounts
Authorization: Basic dGVzdC52cGxleEBjb3JwX2xkYXBfc2VydmljZV9jaGk6VHJAcXNQODch
Cookie: OwnerId={owner_id}; Path=/

Response

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

{
  "itemNotFound" : {
    "guid" : "4383366c-845c-4311-97ee-9dd7d7d0045b",
    "message" : "Resource not found",
    "code" : 404,
    "details" : ""
  }
}

Product could not be found

Request

GET /orders/{orderId}/account/products/{non-existent_productId}/services/{serviceId}/discounts
Authorization: Basic dGVzdC52cGxleEBjb3JwX2xkYXBfc2VydmljZV9jaGk6VHJAcXNQODch
Cookie: OwnerId={owner_id}; Path=/

Response

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

{
  "itemNotFound" : {
    "guid" : "40caab58-6c0b-4056-97eb-2219afe92ec1",
    "message" : "Resource not found",
    "code" : 404,
    "details" : ""
  }
}

Service could not be found

Request

GET /orders/{orderId}/account/products/{productId}/services/{non-existent_serviceId}/discounts
Authorization: Basic dGVzdC52cGxleEBjb3JwX2xkYXBfc2VydmljZV9jaGk6VHJAcXNQODch
Cookie: OwnerId={owner_id}; Path=/

Response

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

{
  "itemNotFound" : {
    "guid" : "fdbff03e-5992-4c64-a769-94cd61bbb927",
    "message" : "Resource not found",
    "code" : 404,
    "details" : ""
  }
}

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox