edit-icon download-icon

CreateUser

Last Updated: Nov 10, 2017

Interface description

Creates an RAM user.

Request parameters

Action

  • Type: String
  • Required: Yes
  • Description: Operation interface, required. The parameter value is “CreateUser”.

UserName

  • Type: String
  • Required: Yes
  • Description: User name. It consists of a maximum of 64 characters.
  • Format: ^[a-zA-Z0-9\.@\-_]+$

DisplayName

  • Type: String
  • Required: No
  • Description: Display name. It consists of a maximum of 12 characters.
  • Format: ^[a-zA-Z0-9\.@\-\u4e00-\u9fa5]+$

MobilePhone

  • Type: String
  • Required: No
  • Description: An RAM user’s mobile number.
  • Format: International area code-number such as 86-18600008888

Email

  • Type: String
  • Required: No
  • Description: An RAM user’s email address.

Comments

  • Type: String
  • Required: No
  • Description: Remark information. It consists of a maximum of 128 characters.

Required permissions

Action

ram:CreateUser

Resource

acs:ram:*:${AccountId}:user/*

Return parameters

User

  • Type: User
  • Description: User information

Error messages

InvalidParameter.UserName.InvalidChars
  • HTTP Status: 400
  • Error Message: The parameter - “UserName” contains invalid chars.
InvalidParameter.UserName.Length
  • HTTP Status: 400
  • Error Message: The parameter - “UserName” beyond the length limit.
InvalidParameter.DisplayName.InvalidChars
  • HTTP Status: 400
  • Error Message: The parameter - “DisplayName” contains invalid chars.
InvalidParameter.DisplayName.Length
  • HTTP Status: 400
  • Error Message: The parameter - “DisplayName” beyond the length limit.
InvalidParameter.Comments.Length
  • HTTP Status: 400
  • Error Message: The parameter - “Comments” beyond the length limit.
InvalidParameter.MobilePhone.Format
  • HTTP Status: 400
  • Error Message: The format of the parameter - “MobilePhone” is incorrect.
InvalidParameter.Email.Format
  • HTTP Status: 400
  • Error Message: The format of the parameter - “Email” is incorrect.
EntityAlreadyExists.User
  • HTTP Status: 409
  • Error Message: The user does already EXIST.
LimitExceeded.User
  • HTTP Status: 409
  • Error Message: The count of users beyond the current limits.

Operation examples

Request example

Note: To facilitate reading, parameters are not encoded in the following request examples.

  1. https://ram.aliyuncs.com/?Action=CreateUser
  2. &UserName=zhangqiang
  3. &DisplayName=zhangqiang
  4. &MobilePhone=86-18688888888
  5. &Email=zhangqiang@example.com
  6. &Comments=This is a cloud computing engineer.
  7. &<Public request parameters>

Return example

XML format

  1. <CreateUserResponse>
  2. <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
  3. <User>
  4. <UserId>1227489245380721</UserId>
  5. <UserName>zhangqiang</UserName>
  6. <DisplayName>zhangqiang</DisplayName>
  7. <MobilePhone>86-18600008888</MobilePhone>
  8. <Email>zhangqiang@example.com</Email>
  9. <Comments>This is a cloud computing engineer.</Comments>
  10. <CreateDate>2015-01-23T12:33:18Z</CreateDate>
  11. </User>
  12. </CreateUserResponse>

JSON format

  1. {
  2. "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
  3. "User": {
  4. "UserId": "1227489245380721",
  5. "UserName": "zhangqiang",
  6. "DisplayName": "zhangqiang",
  7. "MobilePhone": "86-18600008888",
  8. "Email": "zhangqiang@example.com",
  9. "Comments": "This is a cloud computing engineer".
  10. "CreateDate": "2015-01-23T12:33:18Z"
  11. }
  12. }
Thank you! We've received your feedback.