Accounts-accountId-user:PUT

From Hostway API Documentation
Jump to: navigation, search

PUT /accounts/{accountId}/user

Updates account user credentials.

Contents

Request

PUT /accounts/{accountId}/user

Parameters

accountId - string
The Id of the account.

URI Parameters

None.

Request Headers

Authorization - HTTP Authorization header [1]
The Authentication credentials of the client application.
Content-Type
application/json

Request Body

{
  "userName": "{username}",
  "password": "{password}"
  "securityQuestion": "{securityQuestionCode}",
  "securityAnswer": "{securityAnswer}"
}
 

Parameters

userName
Required. A name for the user that's about to be created. This needs to be unique within the entire security realm (not just within the account).
password
Required only if securityQuestion and securityAnswer were not provided. A password for the user. This needs to be between 8 and 50 characters long inclusive, must contain at least one alpha and at least one numeric character, and must not contain any of the following characters: & ` ' " \ / < > $
securityQuestionCode
Required if password was not provided. The reference code for a question that the user can use to recover the password in case (s)he forgot it. This must be selected from a pre-approved list of questions. If securityQuestion was provided, a securityAnswer must also be provided.
securityAnswer
Required if password was not provided. An answer to the security question. If the user provides the correct answer during password recovery, the password will be reset and (s)he will be allowed to access the account. If securityAnswer was provided, a securityQuestion must also be provided. The API will automatically normalize the security answer by removing starting and ending spaces, lowercase the security answer and replace each sequence of whitespaces with just one single space character.

Response

Status Code

204 No Content
The user was successfully updated
400 Bad Request
The request body was missing a required field or one of the fields did not comply with the requirements (in this case, the response body will contain hints for what went wrong)
401 Unauthorized
Authentication failed
403 Forbidden
Authentication succeeded, but the logged-in user is not allowed to update users in this account. The only users allowed to update this user resource are this very user, account owner(s) of this account, and sales/support agents. An account owner is any account user with the "sitecontrol_account_owner" role.
404 Not Found
Either the account or user does not exist
415 Unsupported Media Type
The Content-Type header was not specified or the specified type is not supported. Use application/json.

Examples

Request

PUT /accounts/test-account/user

{ "userName":"testuser", "password":"password12" }
 

Response

401 Unauthorized
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)

{ "userName":"testuser", "password":"password12" }
 

Response

415 Unsupported Media Type

{"badMediaType": {"message": "Unsupported media", "code": 415, "details": ""}}
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)
Content-Type: application/json

{ "userName":"notvalid-user", "password":"password12" }
 

Response

404 Not Found

{"itemNotFound": {"message": "Resource not found", "code": 404, "details": ""}}
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)
Content-Type: application/json

{ "userName":"testuser", "password":"" }
 

Response

400 Bad Request

{"badRequest": {"message": "POST data error", "code": 400, "details": {"password": "Required"}}}
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)
Content-Type: application/json

{ "userName":"testuser", "password":"pass" }
 

Response

400 Bad Request

{"computeFault": {"message": "The password should be at least 8 characters", "code": 400, "details": ""}}
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)
Content-Type: application/json

{ "userName":"testuser", "password":"pa$$word" }
 

Response

400 Bad Request

{"computeFault": {"message": "The password must contains digits and letters", "code": 400, "details": ""}}
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)
Content-Type: application/json

{ "userName":"testuser", "password":"password" }
 

Response

400 Bad Request

{"computeFault": {"message": "The password must contains at least one digit", "code": 400, "details": ""}}
 

Request

PUT /accounts/test-account/user
Authorization: Basic base64_encode(username:password)
Content-Type: application/json

{ "userName":"testuser", "password":"password12" }
 

Response

204 No Content
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox