Orders-orderId-account-user:GET
From Hostway API Documentation
(Difference between revisions)
Mike.robski (Talk | contribs) |
Mike.robski (Talk | contribs) m (1 revision: Release 99) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
== 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 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="2" | Resource not found | ||
+ | | The specified order does not exist. | ||
+ | |- | ||
+ | | An account was not set for the order. | ||
+ | |- | ||
+ | | align="center" | - | ||
+ | | No user data found for the account. | ||
+ | |- | ||
+ | | 502 Bad Gateway | ||
+ | | align="center" | - | ||
+ | | Failed retrieving user data. | ||
+ | |} | ||
=== Response Body === | === Response Body === | ||
Line 41: | Line 66: | ||
; links - ''list'' | ; links - ''list'' | ||
: [[Hypermedia]] for this resource. Links to self. | : [[Hypermedia]] for this resource. Links to self. | ||
+ | |||
+ | == Example == | ||
+ | === Success === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/account/user | ||
+ | Cookie: OwnerId={owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 200 OK | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "userName": "accountUser1", | ||
+ | "links": [{ | ||
+ | "href": "</nowiki>{{APIBaseURL}}<nowiki>/orders/0000014854c737a28b6dffbe007f000000010001/account/user/", | ||
+ | "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> | ||
+ | |||
+ | === Order does not exist === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{non-existent_orderId}/account/user | ||
+ | Cookie: OwnerId={owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 404 Not found | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "itemNotFound": { | ||
+ | "guid": "b0b38b3e-b693-4021-8116-b59f7ec3fea7", | ||
+ | "message": "Resource not found", | ||
+ | "code": 404, | ||
+ | "details": "" | ||
+ | } | ||
+ | }</nowiki> | ||
+ | |||
+ | === Account has not been set === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | GET /orders/{orderId}/account/user | ||
+ | Cookie: OwnerId={owner_id}; Path=/</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 404 Not found | ||
+ | Content-Type : application/json; charset=UTF-8 | ||
+ | |||
+ | { | ||
+ | "itemNotFound": { | ||
+ | "guid": "0c0c1f50-8d80-4423-b501-0a3cc5f070af", | ||
+ | "message": "", | ||
+ | "code": 404, | ||
+ | "details": "" | ||
+ | } | ||
+ | }</nowiki> | ||
== See also == | == See also == |
Latest revision as of 09:06, 14 October 2014
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 |
Request
GET /orders/{orderId}/account/user
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 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. |
Response Body
{ "userName": "{userName}", "links": [ {"href": "https://api.hostway.com/orders/{order_id}/account/user/", "rel": "self"} ] }
Parameters
- userName - string
- The username of the account login credentials.
- links - list
- Hypermedia for this resource. Links to self.
Example
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" }] }
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.
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" : "" } }
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": "" } }
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": "" } }
See also