This API enables you to add a user to vCenter Chargeback Manager. A user type can be local, ldapuser, or ldapgroup. Only an administrator or a super-user can add a user.
This API cannot be used to add vCenter Server users.
You must have the Super User role or the Administrator role.
The syntax for calling this method is:
POST <Base_Url>/user
A sample API call is as follows:
POST https://123.123.123.123/vCenter-CB/api/user
The API takes a request XML that captures the following body parameters.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Users/User |
|
1 |
1 |
This is the user element |
Users/User/Type |
xs:string |
1 |
1 |
Type of the user. Type can be local, ldapgroup or ldapuser. |
Users/User/Name |
xs:string |
1 |
1 |
Name of the user. |
Users/User/Password |
xs:string |
1 |
1 |
Password for the user. The password is used only if the user type is local. The password must contain at least 8 characters and should not exceed 24 characters. The password cannot be same as the user name. Also, the password must contain a combination of upper-case and lower-case characters. |
Users/User/Role/@id |
xs:int |
1 |
1 |
ID of the role assigned to the new user. |
Users/User/LdapServer/@Id |
xs:int |
0 |
1 |
Mandatory field while adding ldapuser or ldapgroup. The LDAP Server ID should be specified only if user type is ldapuser or ldapgroup. |
A sample request XML is provided here.
If the operation is successful, the API gets an XML response with the following details.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Users/User |
|
1 |
1 |
Represents the user element |
Users/User/@id |
xs:string |
1 |
1 |
ID of the user which was added. |
Users/User/Name |
xs:string |
1 |
1 |
Name of the user. |
Users/User/Type |
xs:string |
1 |
1 |
Type of the user. Type can be local, ldapgroup, or ldapuser. The LdapServerId should be specified only if user type is ldapuser or ldapgroup. |
Users/User/Role/@id |
xs:int |
1 |
1 |
Role assigned to the user on vCenter Chargeback Manager. |
Users/User/CreatedByUser |
xs:int |
1 |
1 |
ID of the user who created this user. |
Users/User/LdapServer/@id |
xs:int |
1 |
1 |
LDAP server ID in case of LDAP user/group. The LDAP Server ID will be displayed only if user type is ldapuser or ldapgroup. |
Users/User/VCenterServer/@id |
xs:int |
1 |
1 |
vCenter server user ID that the user belongs to. The vCenter Server ID will be displayed only if the user type is vcuser. |
LdapServers/LdapSever |
|
|
|
|
LdapServers/LdapSever/@id |
xs:int |
0 |
1 |
LDAP server ID |
LdapServers/LdapServer/Host |
xs:string |
1 |
1 |
LDAP server URL |
LdapServers/LdapServer/Port |
xs:int |
1 |
1 |
LDAP server port |
LdapServers/LdapServer/BaseDn |
xs:string |
1 |
1 |
LDAP server base DN |
LdapServers/LdapServer/LdapServerName |
xs:string |
1 |
1 |
LDAP server name |
LdapServers/LdapServer/LdapServerType |
|
|
|
|
LdapServers/LdapServer/LdapServerType/@id |
xs:int |
1 |
1 |
LDAP server type. |
LdapServers/LdapServer/LdapServerType/Name |
xs:string |
1 |
1 |
Name of the LDAP server type. |
LdapServers/LdapServer/Limit |
xs:int |
1 |
1 |
LDAP server limit |
VCenterServers/VCenterServer |
|
|
|
|
VCenterServers/VCenterServer/@id |
xs:int |
0 |
1 |
vCenter Server ID |
VCenterServers/VCenterServer/Url |
xs:string |
1 |
1 |
vCenter Server URL |
VCenterServers/VCenterServer/Name |
xs:string |
1 |
1 |
vCenter Server name |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error code |
Description |
VCENTER_COMMON_ERR_USER_NOT_AUTHENTICATED |
User is not authenticated to perform this operation. |
VCENTER_COMMON_ERR_INVALID_INPUT_XML |
The request XML is not in the desired format. |
VCB_ERR_NAME_TOO_LONG |
Name is longer than 255 characters. |
VCB_ERR_PASSWORD_TOO_LONG |
Password is longer than 24 characters, or invalid password. |
VCB_ERR_USER_NAME_EXISTS |
A user with same name exists |
VCB_ERR_LDAP_SERVER_NOT_FOUND |
No LDAP server exists with the given LdapServerId |
VCB_ERR_LDAP_SERVER_CONNECTION |
The connection with the LDAP server failed. |
VCB_ERR_LDAP_SERVER_AUTHENTICATION |
The authentication with the LDAP server failed. |
VCB_ERR_NAME_NOT_FOUND |
No LDAP user or group with the given name exists in the LDAP server |
VCB_ERR_INVALID_USER_TYPE |
The userType of the user with the given userId is not local, ldapuser or ldapgroup. |
VCB_ERR_RBAC_CREATE_NOT_PERMITTED |
User does not have permission to create a user. |
VCB_ERR_PASSWORD_NONCONFORMANT |
The password provided does not conform to the password rules in vCenter Chargeback Manager. |