Modify User

This API enables you to modify an existing user. For users of type ldapuser or ldapgroup, you can only assign or remove the role. For users of type local, you can reset the password of the local user in addition to assigning and removing the super user role.

User Privileges Required

You must be the creator of the user or have the Super User role.

Syntax

The syntax for calling this method is:

PUT <Base_Url>/user/{userId}

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/user/1

Request Body Parameters

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/@id

xs:string

1

1

ID of the user.

Users/User/NewPassword

xs:string

1

1

New password to be set for the user.

A sample request XML is provided here.

API Response

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.

Error Response

The following table explains the error codes displayed by the API.

Error code

Description

VCENTER_COMMON_ERR_INSUFFICIENT_PERMISSION

User does not have the required permissions to perform this operation.

VCENTER_COMMON_ERR_USER_NOT_AUTHENTICATED

User is not authenticated to perform this operation.

VCB_ERR_USER_NOT_FOUND

No user exists with the given “userId”

VCB_ERR_PASSWORD_TOO_LONG

The new password is longer than 24 characters.

VCB_ERR_SAME_PASSWORD

The new password is the same as the old password.

VCB_ERR_ALTER_SUPERUSER

The user corresponding to the given userId is an administrator and the user is attempting to revoke super user role from the administrator.

VCB_ERR_LDAP_USER_PASSWORD_CANNOT_CHANGE

The user is trying to change the LDAP user password.

VCB_ERR_LDAP_GROUP_PASSWORD_CANNOT_CHANGE

The user is attempting to change the LDAP group password.

VCB_ERR_PASSWORD_MISMATCH

The old password does not match the stored password.

VCB_ERR_PASSWORD_NONCONFORMANT

The password provided does not conform to the password rules in vCenter Chargeback Manager.