Orders-orderId:GET

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
 
m (1 revision: Release 98)
 
(4 intermediate revisions by 3 users not shown)
Line 20: Line 20:
  
 
=== Status Code ===
 
=== Status Code ===
;200 OK
+
{| class="wikitable"
: Success.
+
! Status Code
 
+
! Error Message
;401 Unauthorized
+
! Description
: The '''OwnerId''' cookie or the '''Authorization''' header are not specified or do not permit access to the specified order.
+
|-
 
+
| 200 OK
;404 Not Found
+
| align="center" | -
: The specified order does not exist.
+
| 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 35: Line 48:
 
{
 
{
 
   "order": {
 
   "order": {
     "status": "{orderStatus}"
+
     "Status": "{orderStatus}",
 +
    "Account": "{accountUrl}"
 
   },
 
   },
 
   "links": {
 
   "links": {
 
     "self": {"href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/{orderId}/", "rel": "self"}
 
     "self": {"href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/{orderId}/", "rel": "self"}
 
   }
 
   }
}
+
}</nowiki>
</nowiki>
+
  
 
==== Parameters ====
 
==== Parameters ====
 
; orderStatus - ''string''
 
; orderStatus - ''string''
 
: The status of the order.
 
: The status of the order.
 +
 +
; accountUrl - ''string (optional)''
 +
: [[Hypermedia]] for the account of this order. Link to the account.
  
 
; links - ''list''
 
; links - ''list''
Line 52: Line 68:
 
== Example ==
 
== Example ==
  
=== Request ===
+
=== 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>
</nowiki>
+
  
=== Response ===
+
'''Response'''
 
  <nowiki>
 
  <nowiki>
 
200 OK
 
200 OK
Line 65: Line 81:
 
{
 
{
 
   "order": {
 
   "order": {
     "status": "new"
+
     "Status": "new",
 +
    "Account": "http://accounts/acc20130821"
 
   },
 
   },
   "links": {
+
   "links": [ {
     "self": {"href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/0000013ca61880fbfc068b33000a02c9d8ef861c/", "rel": "self"}
+
     "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}'' ==

Latest revision as of 07:51, 15 September 2014

[edit] GET /orders/{orderId}

Returns the content of an order specified by the URI.

Contents

[edit] Request

GET /orders/{orderId}

[edit] Parameters

orderId - string
The unique order Id. The URI of the order is returned by the POST /orders call.

[edit] URI Parameters

None.

[edit] 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.

[edit] Response

[edit] 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.

[edit] 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"}
  }
}

[edit] 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.

[edit] Example

[edit] 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"
  } ]
}

[edit] 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.

[edit] 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": ""
  }
}

[edit] 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": ""
 }
}

[edit] 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}

[edit] Parameters

order_id - string
The unique order Id. The full URI of each order is returned by the POST /orders call.

[edit] 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.

[edit] Response Status Code

200 OK
Success.
404 Not Found
The specified order does not exist.

[edit] 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 *.

[edit] See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox