Orders-orderId-account-user:PUT

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
(Status Code)
m (1 revision: Release 99)
 
(2 intermediate revisions by 2 users not shown)
Line 56: Line 56:
 
| align="center" | -
 
| align="center" | -
 
| No owner Id specified or the specified owner is not authorized to set user credentials.
 
| No owner Id specified or the specified owner is not authorized to set user credentials.
 +
|-
 +
| 403 Forbidden
 +
| Unauthorized: User failed permission check
 +
| Set user credentials as an authenticated user, not associated with the order.
 
|-
 
|-
 
| 404 Not Found
 
| 404 Not Found
Line 174: Line 178:
 
  <nowiki>
 
  <nowiki>
 
PUT /orders/{orderId}/account/user
 
PUT /orders/{orderId}/account/user
Cookie: OwnerId={wrong_owner_id}; Path=/</nowiki>
+
Cookie: OwnerId={wrong_owner_id}; Path=/
 +
 
 +
{
 +
  "userName": "accountUser1",
 +
  "password": "userPass1"
 +
}</nowiki>
  
 
'''Response'''
 
'''Response'''
Line 186: Line 195:
 
Either you supplied the wrong credentials (e.g., bad password),
 
Either you supplied the wrong credentials (e.g., bad password),
 
or your browser does not understand how to supply the credentials required.</nowiki>
 
or your browser does not understand how to supply the credentials required.</nowiki>
 +
 +
=== Unauthorized user ===
 +
'''Request'''
 +
<nowiki>
 +
PUT /orders/{orderId}/account/user
 +
Authorization: {unassociated_user_authorization}
 +
 +
{
 +
  "userName": "accountUser1",
 +
  "password": "userPass1"
 +
}</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 ===
 
=== Order does not exist ===
Line 207: Line 241:
 
}</nowiki>
 
}</nowiki>
  
=== Existing account in Service Plex ===
+
=== Existing account in the system ===
 
'''Request'''
 
'''Request'''
 
  <nowiki>
 
  <nowiki>

Latest revision as of 10:06, 14 October 2014

[edit] PUT /orders/{orderId}/account/user

Sets or updates the account user credentials in a given order.

Contents


[edit] Request

PUT /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

Content-Type
Required. Set this header to application/json; charset=UTF-8
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] Request Body

{
  "userName": "mytestuser1",
  "password": "Mytestpass1"
}
 

[edit] Parameters

userName - string
Required string max 50 characters. Only letters, digits and dot (.), dash (-), underscore (_) and at sign (@) are allowed.
password - string
Required string min 8, max 50 characters. Must include at least one letter and one digit. The following characters are not allowed: &`'"\/<>$.

[edit] Response

[edit] Status Code

Status Code Error Message Description
200 OK - The operation was successfully completed.
400 Bad Request POST data error JSON is invalid
Username or password is missing.
Username or password breaks its format rules.
401 Unauthorized - No owner Id specified or the specified owner is not authorized to set user credentials.
403 Forbidden Unauthorized: User failed permission check Set user credentials as an authenticated user, not associated with the order.
404 Not Found Resource not found Order does not exist.
409 Confict Data conflict The same username already exists in the system.
502 Bad Gateway - Account hasn't been added

[edit] Response Body

None.


[edit] Example

[edit] Successfully add/update user to order

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

{
  "userName": "accountUser1",
  "password": "userPass1"
}

Response

204 No Content

[edit] Missing username

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

{
  "password": "userPass1"
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "50f051a3-8325-4064-b174-d82d78da83d9",
    "message": "POST data error",
    "code": 400,
    "details": {
      "userName": "Required"
    }
  }
}

[edit] Invalid username

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

{
  "userName": "user:name"
  "password": "userPass1"
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "50f051a3-8325-4064-b174-d82d78da83d9",
    "message": "POST data error",
    "code": 400,
    "details": {
      "userName": "Only letters, digits and dot (.), dash (-), underscore (_) and at sign (@) are allowed"
    }
  }
}

[edit] Invalid password

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

{
  "userName": "accountUser1"
  "password": "userPass$$$"
}

Response

400 Bad Request
Content-Type : application/json; charset=UTF-8

{
  "badRequest": {
    "guid": "9cdfae0e-ad2a-4759-a5ef-ceddd2ac14be",
    "message": "POST data error",
    "code": 400,
    "details": {
      "password": "The following characters are not allowed: &`'\"\\/<>$"
    }
  }
}

[edit] No authorization

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={wrong_owner_id}; Path=/

{
  "userName": "accountUser1",
  "password": "userPass1"
}

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

PUT /orders/{orderId}/account/user
Authorization: {unassociated_user_authorization}

{
  "userName": "accountUser1",
  "password": "userPass1"
}

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

PUT /orders/{non-existent_orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

Response

404 Not found
Content-Type : application/json; charset=UTF-8

{
  "itemNotFound": {
    "guid": "cca219c5-3e2b-481d-8e7f-7083064872ff",
    "message": "Resource not found",
    "code": 404,
    "details": ""
  }
}

[edit] Existing account in the system

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

{
  "userName": "zxc01"
  "password": "Mytestpass1"
}

Response

409 Conflict
Content-Type : application/json; charset=UTF-8

{
  "conflict": {
    "guid": "5c817267-5302-4ea6-abd7-bc9b77f01082",
    "message": "Data conflict",
    "code": 409,
    "details": ""
  }
}

[edit] Account has not been set

Request

PUT /orders/{orderId}/account/user
Cookie: OwnerId={owner_id}; Path=/

{
  "userName": "accountUser1"
  "password": "userPass1"
}

Response

502 Bad Gateway
Content-Type : application/json; charset=UTF-8

{
  "computeFault": {
    "guid": "a4f6b310-11d9-4263-8482-81bccf261df7",
    "timestamp": "2014-09-08 08:34:20",
    "code": 502,
    "errorRefId":
    "a4f6b310-11d9-4263-8482-81bccf261df7"
  }
}

[edit] See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox