Orders-orderId-account-user:GET
From Hostway API Documentation
(Difference between revisions)
(→Status Code) |
Mike.robski (Talk | contribs) m (1 revision: Release 99) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 27: | Line 27: | ||
| align="center" | - | | align="center" | - | ||
| The operation was successfully completed. | | The operation was successfully completed. | ||
+ | |- | ||
+ | | 401 Unauthorized | ||
+ | | align="center" | - | ||
+ | | No owner Id specified or the specified owner is not authorized to set user credentials. | ||
+ | |- | ||
+ | | 403 Forbidden | ||
+ | | Unauthorized: User failed permission check | ||
+ | | Retrieve user as an authenticated user, not associated with the order. | ||
|- | |- | ||
| rowspan="3" | 404 Not Found | | rowspan="3" | 404 Not Found | ||
Line 77: | Line 85: | ||
"rel": "self" | "rel": "self" | ||
}] | }] | ||
+ | }</nowiki> | ||
+ | |||
+ | === No authorization === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/account/user | ||
+ | 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}/account/user | ||
+ | Authorization: {unassociated_user_authorization}</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 403 Forbidden | ||
+ | Content-Type: application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "forbidden" : { | ||
+ | "guid" : "66f63a81-52e9-4ec6-a50a-42acebc021e7", | ||
+ | "message" : "Unauthorized: User failed permission check", | ||
+ | "code" : 403, | ||
+ | "details" : "" | ||
+ | } | ||
}</nowiki> | }</nowiki> | ||
Latest revision as of 09:06, 14 October 2014
[edit] GET /orders/{orderId}/account/user
Get details of the account user for the given order. A user with auto-generated information is created by default when the account is created. The user password is excluded from the response.
Contents |
[edit] Request
GET /orders/{orderId}/account/user
[edit] Request 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.
[edit] Response
[edit] 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 set user credentials. |
403 Forbidden | Unauthorized: User failed permission check | Retrieve user as an authenticated user, not associated with the order. |
404 Not Found | Resource not found | The specified order does not exist. |
An account was not set for the order. | ||
- | No user data found for the account. | |
502 Bad Gateway | - | Failed retrieving user data. |
[edit] Response Body
{ "userName": "{userName}", "links": [ {"href": "https://api.hostway.com/orders/{order_id}/account/user/", "rel": "self"} ] }
[edit] Parameters
- userName - string
- The username of the account login credentials.
- links - list
- Hypermedia for this resource. Links to self.
[edit] Example
[edit] Success
Request
GET /orders/{orderId}/account/user Cookie: OwnerId={owner_id}; Path=/
Response
200 OK Content-Type : application/json; charset=UTF-8 { "userName": "accountUser1", "links": [{ "href": "https://api.hostway.com/orders/0000014854c737a28b6dffbe007f000000010001/account/user/", "rel": "self" }] }
[edit] No authorization
Request
GET /orders/{orderId}/account/user 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.
[edit] Unauthorized user
Request
GET /orders/{orderId}/account/user Authorization: {unassociated_user_authorization}
Response
403 Forbidden Content-Type: application/json; charset=UTF-8 { "forbidden" : { "guid" : "66f63a81-52e9-4ec6-a50a-42acebc021e7", "message" : "Unauthorized: User failed permission check", "code" : 403, "details" : "" } }
[edit] Order does not exist
Request
GET /orders/{non-existent_orderId}/account/user Cookie: OwnerId={owner_id}; Path=/
Response
404 Not found Content-Type : application/json; charset=UTF-8 { "itemNotFound": { "guid": "b0b38b3e-b693-4021-8116-b59f7ec3fea7", "message": "Resource not found", "code": 404, "details": "" } }
[edit] Account has not been set
Request
GET /orders/{orderId}/account/user Cookie: OwnerId={owner_id}; Path=/
Response
404 Not found Content-Type : application/json; charset=UTF-8 { "itemNotFound": { "guid": "0c0c1f50-8d80-4423-b501-0a3cc5f070af", "message": "", "code": 404, "details": "" } }
[edit] See also