Orders-orderId-quote:GET
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision: Release 90) |
|||
Line 16: | Line 16: | ||
== Response == | == Response == | ||
− | |||
=== Status Code === | === Status Code === | ||
− | + | {| class='wikitable' | |
− | + | |- | |
− | + | ! Status Code | |
− | + | ! Error Message | |
− | + | ! Description | |
+ | |- | ||
+ | | 200 OK | ||
+ | | align="center" | - | ||
+ | | The operation was successfully completed. | ||
+ | |- | ||
+ | | 401 Unauthorized | ||
+ | | align="center" | - | ||
+ | | No owner Id specified or the specified owner is not authorized to get quote for this order. | ||
+ | |- | ||
+ | | 403 Forbidden | ||
+ | | Unauthorized: Fees failed permission check | ||
+ | | The user does not have sufficient privilege. | ||
+ | |- | ||
+ | | 404 Not Found | ||
+ | | Resource not found | ||
+ | | The specified order does not exist. | ||
+ | |- | ||
+ | | 502 Bad Gateway | ||
+ | | align="center" | - | ||
+ | | Unexpected backend response. Cannot retrieve order quote. | ||
+ | |} | ||
=== Response Body === | === Response Body === | ||
Line 173: | Line 193: | ||
; links - ''list'' | ; links - ''list'' | ||
: [[Hypermedia]] for this resource. Links to self. | : [[Hypermedia]] for this resource. Links to self. | ||
+ | |||
+ | == Example == | ||
+ | === Get empty quote info === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/quote | ||
+ | Cookie: OwnerId={owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 200 OK | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "quote": { | ||
+ | "PurchasedPlan": [], | ||
+ | "Hash": "26d42ebf46c38b3eaabca48a0f588d90e8f542fc", | ||
+ | "Currency": "USD", | ||
+ | "Total": "0", | ||
+ | "SubTotal": "0", | ||
+ | "OneTimeFeeAmount": "0", | ||
+ | "TaxTotal": "0" | ||
+ | }, | ||
+ | "links": { | ||
+ | "self": { | ||
+ | "href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/0000014854ec1d454e9cfd3d007f000000010001/quote/", | ||
+ | "rel": "self" | ||
+ | } | ||
+ | } | ||
+ | }</nowiki> | ||
+ | |||
+ | === No authorization === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/quote | ||
+ | Cookie: OwnerId={wrong_owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 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.</nowiki> | ||
+ | |||
+ | === Unauthorized user === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/quote | ||
+ | Authorization: Basic {wrong_user_authorization}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 403 Forbidden | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "forbidden": { | ||
+ | "guid": "ea88f675-dc71-410e-9e72-84f0944a289a", | ||
+ | "message": "Unauthorized: Fees failed permission check", | ||
+ | "code": 403, | ||
+ | "details": "" | ||
+ | } | ||
+ | }</nowiki> | ||
+ | |||
+ | === Order does not exist === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{non-existent_orderId}/quote | ||
+ | Cookie: OwnerId={owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 404 Not found | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "itemNotFound": { | ||
+ | "guid": "92b7773f-e224-4971-a3dd-60fbd9c7129a", | ||
+ | "message": "Resource not found", | ||
+ | "code": 404, | ||
+ | "details": "" | ||
+ | } | ||
+ | }</nowiki> | ||
== See also == | == See also == |
Revision as of 04:00, 15 September 2014
GET /orders/{orderId}/quote
Get quote for a given order.
Contents |
Request
GET /orders/{orderId}/quote
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
- 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 operation was successfully completed. |
401 Unauthorized | - | No owner Id specified or the specified owner is not authorized to get quote for this order. |
403 Forbidden | Unauthorized: Fees failed permission check | The user does not have sufficient privilege. |
404 Not Found | Resource not found | The specified order does not exist. |
502 Bad Gateway | - | Unexpected backend response. Cannot retrieve order quote. |
Response Body
{ "quote": { "Hash": "42fc1e100808efc62dadf8ad027d424dff30d6f1", "Currency": "USD", "Products": [ { "Services": [], "PlanNumber": "00000139b5dd73be7f14d3f8000a88fa0fa65d70", "PromotionCode": "promo_1234", "PromotionName": "Seasonal Discount 25% off all dedicated servers for 3 months" "Fees": [ { "ProrationAllowed": "0", "StartDate": "2012-09-11", "NumCharged": "0", "EndDate": "2012-09-11", "Description": "Setup fee ", "BaseAmount": "100.00", "UnitAmount": "100.00", "Prorated": "0", "MonthlyCycle": "1", "Currency": "USD", "Amount": "100.00", "NumCharges": "1", "ProratedUnitAmount": "100.00", "Type": "setup_fee", "Quantity": "1" }, { "ProrationAllowed": "1", "StartDate": "2012-09-11", "NumCharged": "0", "EndDate": "2012-10-10", "Description": "Recurring fee", "BaseAmount": "239.00", "UnitAmount": "239.00", "Prorated": "0", "MonthlyCycle": "1", "Currency": "USD", "Amount": "239.00", "NumCharges": "-1", "ProratedUnitAmount": "239.00", "Type": "recurring", "Quantity": "1", } ] } ], "Total": "339.00", "SubTotal": "339.00", "OneTimeFeeAmount": "100.00", "TaxTotal": "0" }, "links": [ {"href": "https://api.hostway.com/orders/{orderId}/quote/", "rel": "self"} ] }
Parameters
- quote - dictionary
- Quote's ordered items info
- Hash - string
- Hash string of this particular order.
- Currency - string
- The currency for this particular order. Must be a ISO-4217 currency code. ex. USD, CAD, etc.
- Products - list
- List of plan products
- Services - list
- List of product services
- PlanNumber - string
- Plan number identifier
- PromotionCode - string
- Promotion code, if any (applied at the time the product was added to the order)
- PromotionName - string
- (OPTIONAL)
- Name or short description of the promotion that was applied, if any
- Fees - list
- List of product fees
- ProrationAllowed - integer
- Number indicating whether fee proration is allowed
- StartDate - date
- Start date of the fee
- NumCharged - integer
- Number how many times this fee is charged
- EndDate - date
- End date the fee is applied
- Description - string
- Description info for this fee
- BaseAmount - decimal
- Base amount for this fee
- UnitAmount - decimal
- Unit amount for this fee
- Prorated - integer
- Integer indicating whether this fee is prorated
- MonthlyCycle - integer
- Billing cycle in months for this fee
- Currency - string
- The currency for this particular fee. Must be a ISO-4217 currency code. ex. USD, CAD, etc.
- Amount - decimal
- The actual fee amount
- NumCharges - integer
- Number of charges for this fee
- ProratedUnitAmount - decimal
- The prorated unit amount
- Type - string
- The type of this fee
- Quantity - integer
- The quantity for this fee
- Total - decimal
- Total sum for this quote
- SubTotal - decimal
- Subtotal sum for this quote
- OneTimeFeeAmount - decimal
- One time payable fee amount
- TaxTotal - decimal
- Tax total value
- links - list
- Hypermedia for this resource. Links to self.
Example
Get empty quote info
Request
GET /orders/{orderId}/quote Cookie: OwnerId={owner_id}; Path=/
Response
200 OK Content-Type : application/json; charset=UTF-8 { "quote": { "PurchasedPlan": [], "Hash": "26d42ebf46c38b3eaabca48a0f588d90e8f542fc", "Currency": "USD", "Total": "0", "SubTotal": "0", "OneTimeFeeAmount": "0", "TaxTotal": "0" }, "links": { "self": { "href": "https://api.hostway.com/orders/0000014854ec1d454e9cfd3d007f000000010001/quote/", "rel": "self" } } }
No authorization
Request
GET /orders/{orderId}/quote Cookie: OwnerId={wrong_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.
Unauthorized user
Request
GET /orders/{orderId}/quote Authorization: Basic {wrong_user_authorization}; Path=/
Response
403 Forbidden Content-Type : application/json; charset=UTF-8 { "forbidden": { "guid": "ea88f675-dc71-410e-9e72-84f0944a289a", "message": "Unauthorized: Fees failed permission check", "code": 403, "details": "" } }
Order does not exist
Request
GET /orders/{non-existent_orderId}/quote Cookie: OwnerId={owner_id}; Path=/
Response
404 Not found Content-Type : application/json; charset=UTF-8 { "itemNotFound": { "guid": "92b7773f-e224-4971-a3dd-60fbd9c7129a", "message": "Resource not found", "code": 404, "details": "" } }
See also