edit-icon download-icon

API for user management

Last Updated: Nov 06, 2017

Add Users

This API is used to add users.

Request parameters

Field Type Required? Default value Description
Action String Yes - Operation interface name, required parameter; value: AddUsers.
RegionId String Yes - Region ID.
ClusterId String Yes - Cluster ID.
User.n.Name String Yes - User name of the nth account to be added (n starts from 1. You can enter n multiple times.) It is a string of 6 to 30 uppercase/lowercase letters, numbers, and “.”. It must begin with a letter.
User.n.Group String Yes - User group of the nth account to be added (n starts from 1. You can enter n multiple times.) Currently, only user groups ‘users’ and ‘wheel’ are supported. ‘wheel’ is the user group with sudo permissions.
User.n.Password String Yes - Password of the nth account to be added (n starts from 1. You can enter n multiple times.) The password is a string of 8 to 30 characters and must contain uppercase/lowercase letters, numbers, and special characters. Call API by HTTPS to prevent password leakage.

Return parameters

Public return parameters.

Error codes

Code Description
InvalidParams Invalid parameters
UsernameExist The user name already exists.
UnknownError Unknown error

DeleteUsers

Request parameters

Field Type Required? Default value Description
Action String Yes - Operation interface name, required parameter; value: DeleteUsers
RegionId String Yes - Region ID
ClusterId String Yes - Cluster ID
User.n.Name String Yes - User name of the nth account to be deleted (n starts from 1. Multiple entries are supported.)

Note: Files in the home directory cannot be deleted.

Return parameters

Public return parameters.

Error codes

Code Description
InvalidParams Invalid parameters.
UsernameNotExist The user name does not exist.
UnknownError Unknown error.

ListUsers

Request parameters

Field Type Required? Default value Description
Action String Yes - Operation interface name, required parameter; value: ListUsers
RegionId String Yes - Region ID
ClusterId String Yes - Cluster ID
PageNumber Integer No 1 Displayed page number; initial value: 1
PageSize Integer No 10 Number of entries per page; value range: 1 to 50

Return parameters

Public return parameters and the following parameters:

Field Type Description
Users Array\ Array of user accounts
TotalCount Integer Total number of entries in the list
PageNumber Integer Current page number
PageSize Integer Number of entries on the current page

Each element of the UserInfo structure includes the following fields:

Field Type Description
Name String User name.
Group String User permission group. Currently, user groups ‘users’ and ‘wheel’ are supported. Users in user group ‘users’ have general permissions, and users in user group ‘wheel’ have sudo permissions.
AddTime String User addition time.

Error codes

Code Description
InvalidParams Invalid parameters
UnknownError Unknown error

ModifyUserGroups

Request parameters

Field Type Required? Default value Description
Action String Yes - Operation interface, required; value: ModifyUserGroups.
RegionId String Yes - Region ID.
ClusterId String Yes - Cluster ID.
Users String Yes - Array of modified user information, in JSON string format, for example, ‘[{“Username”:”somename1”,”Group”:”users”},{“Username”:”somename2”,”Group”:”wheel”}]’.
User.n.Name String Yes - User name of the nth account whose user group to be modified. (n starts from 1. Multiple entries are sepported.)
User.n.Group String Yes - User group of the nth account to be modified (n starts from 1. You can enter n multiple times.) Currently, only user groups ‘users’ and ‘wheel’ are supported. ‘wheel’ is the user group with sudo permissions.

Return parameters

Public return parameters.

Error codes

Code Description
InvalidParams Invalid parameters.
UsernameNotExist The user name does not exist.
UnknownError Unknown error.

ModifyUserPasswords

Request parameters

Field Type Required? Default value Description
Action String Yes - Operation interface name, required parameter; value: ModifyUserPasswords.
RegionId String Yes - Region ID.
ClusterId String Yes - Cluster ID.
User.n.Name String Yes - User name of the nth account whose to be modified. (n starts from 1. Multiple extries are supported.)
User.n.Password String Yes - New password of the nth account (n starts from 1. You can enter n multiple times.) The password is a string of 8 to 30 characters and must contain uppercase/lowercase letters, numbers, and special characters. Call API by HTTPS to prevent password leakage.

Return parameters

Public return parameters.

Error codes

Code Description
InvalidParams Invalid parameters.
UsernameNotExist The user name does not exist.
UnknownError Unknown error.
Thank you! We've received your feedback.