Orders-orderId:GET

From Hostway API Documentation
Jump to: navigation, search

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


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox