Orders-orderId:GET
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision: Release 85) |
|||
Line 20: | Line 20: | ||
=== Status Code === | === Status Code === | ||
− | + | {| class="wikitable" | |
− | + | ! Status Code | |
− | + | ! Error Message | |
− | + | ! Description | |
− | + | |- | |
− | + | | 200 OK | |
− | + | | align="center" | - | |
− | + | | Success. | |
+ | |- | ||
+ | | 401 Unauthorized | ||
+ | | align="center" | - | ||
+ | | The '''OwnerId''' cookie or the '''Authorization''' header are not specified or do not permit access to the specified order. | ||
+ | |- | ||
+ | | 403 Forbidden | ||
+ | | Unauthorized: Order failed permission check | ||
+ | | Access an associated order as an authenticated user, not associated with the order. | ||
+ | |- | ||
+ | | 404 Not Found | ||
+ | | Resource not found | ||
+ | | The specified order does not exist. | ||
+ | |} | ||
=== Response Body === | === Response Body === | ||
Line 41: | Line 54: | ||
"self": {"href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/{orderId}/", "rel": "self"} | "self": {"href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/{orderId}/", "rel": "self"} | ||
} | } | ||
− | } | + | }</nowiki> |
− | + | ||
==== Parameters ==== | ==== Parameters ==== | ||
Line 56: | Line 68: | ||
== Example == | == Example == | ||
− | === | + | === Get order information === |
+ | '''Request''' | ||
<nowiki> | <nowiki> | ||
GET /orders/0000013ca61880fbfc068b33000a02c9d8ef861c | GET /orders/0000013ca61880fbfc068b33000a02c9d8ef861c | ||
− | Cookie: OwnerId=948ce0d4-7cf0-43b6-88a5-2b3f1331b689; Path=/ | + | Cookie: OwnerId=948ce0d4-7cf0-43b6-88a5-2b3f1331b689; Path=/</nowiki> |
− | + | ||
− | + | '''Response''' | |
<nowiki> | <nowiki> | ||
200 OK | 200 OK | ||
Line 72: | Line 84: | ||
"Account": "http://accounts/acc20130821" | "Account": "http://accounts/acc20130821" | ||
}, | }, | ||
− | "links": { | + | "links": [ { |
− | + | "href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/0000013ca61880fbfc068b33000a02c9d8ef861c/", | |
+ | "rel": "self" | ||
+ | } ] | ||
+ | }</nowiki> | ||
+ | |||
+ | === Get info with wrong OwnerId === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/000001483b9336c4be0a0c89000a19010d347ea1 | ||
+ | Cookie: OwnerId={wrong_order_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> | ||
+ | |||
+ | === Unassociated user without cookie=== | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/000001483b9336c4be0a0c89000a19010d347ea2 | ||
+ | Authorization: {unassociated_user_authorization}</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 403 Forbidden | ||
+ | Content-Type: application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "forbidden": { | ||
+ | "guid": "4d1e97e2-1497-48d5-b7a3-b3726656c4b5", | ||
+ | "message": "Unauthorized: Order failed permission check", | ||
+ | "code": 403, | ||
+ | "details": "" | ||
} | } | ||
− | } | + | }</nowiki> |
− | </nowiki> | + | |
+ | === Unexisting order === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/000001483b9336c4be0a0c89000a19010d347ea2 | ||
+ | Cookie: OwnerId=0b3fc7bd-6905-4de7-bddb-43d2c7365e7a; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 404 Not Found | ||
+ | Content-Type: application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "itemNotFound": { | ||
+ | "guid": "286aab08-7a2b-41a7-81fa-6530f14ed728", | ||
+ | "message": "Resource not found", | ||
+ | "code": 404, | ||
+ | "details": "" | ||
+ | } | ||
+ | }</nowiki> | ||
== OPTIONS /orders/''{order_id}'' == | == OPTIONS /orders/''{order_id}'' == |
Revision as of 03:51, 12 September 2014
GET /orders/{orderId}
Returns the content of an order specified by the URI.
Contents |
Request
GET /orders/{orderId}
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.
- Authorization
- Optional. Specify the Authorization header when requesting details for an order that was already submitted. Follow the instructions for API Authentication.
Response
Status Code
Status Code | Error Message | Description |
---|---|---|
200 OK | - | Success. |
401 Unauthorized | - | The OwnerId cookie or the Authorization header are not specified or do not permit access to the specified order. |
403 Forbidden | Unauthorized: Order failed permission check | Access an associated order as an authenticated user, not associated with the order. |
404 Not Found | Resource not found | The specified order does not exist. |
Response Body
The response body may contain additional information beyond what is specified in the documentation. Such information should be ignored or treated as volatile, since it may change in the future.
{ "order": { "Status": "{orderStatus}", "Account": "{accountUrl}" }, "links": { "self": {"href": "https://api.hostway.com/orders/{orderId}/", "rel": "self"} } }
Parameters
- orderStatus - string
- The status of the order.
- accountUrl - string (optional)
- Hypermedia for the account of this order. Link to the account.
- links - list
- Hypermedia for this resource. Link to the order.
Example
Get order information
Request
GET /orders/0000013ca61880fbfc068b33000a02c9d8ef861c Cookie: OwnerId=948ce0d4-7cf0-43b6-88a5-2b3f1331b689; Path=/
Response
200 OK Content-Type: application/json; charset=UTF-8 { "order": { "Status": "new", "Account": "http://accounts/acc20130821" }, "links": [ { "href": "https://api.hostway.com/orders/0000013ca61880fbfc068b33000a02c9d8ef861c/", "rel": "self" } ] }
Get info with wrong OwnerId
Request
GET /orders/000001483b9336c4be0a0c89000a19010d347ea1 Cookie: OwnerId={wrong_order_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.
Unassociated user without cookie
Request
GET /orders/000001483b9336c4be0a0c89000a19010d347ea2 Authorization: {unassociated_user_authorization}
Response
403 Forbidden Content-Type: application/json; charset=UTF-8 { "forbidden": { "guid": "4d1e97e2-1497-48d5-b7a3-b3726656c4b5", "message": "Unauthorized: Order failed permission check", "code": 403, "details": "" } }
Unexisting order
Request
GET /orders/000001483b9336c4be0a0c89000a19010d347ea2 Cookie: OwnerId=0b3fc7bd-6905-4de7-bddb-43d2c7365e7a; Path=/
Response
404 Not Found Content-Type: application/json; charset=UTF-8 { "itemNotFound": { "guid": "286aab08-7a2b-41a7-81fa-6530f14ed728", "message": "Resource not found", "code": 404, "details": "" } }
OPTIONS /orders/{order_id}
In addition to the GET method the API supports the OPTIONS method for direct browser access to the API. The format of the request is:
OPTIONS /orders/{order_id}
Parameters
- order_id - string
- The unique order Id. The full URI of each order is returned by the POST /orders call.
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
- 200 OK
- Success.
- 404 Not Found
- The specified order does not exist.
Response Headers
- Access-Control-Allow-Methods
- A comma-separated list of request methods supported on this URI.
- Access-Control-Allow-Origin
- All origins are allowed. This header has value *.
See also