Update PostgreSQL username

This function changes a PostgreSQL® database user's name.

Important:

When you disable the PostgreSQL role, the system disables this function.

SecurityBasicAuth
Request
query Parameters
newname
required
string

The database user's new name.

Warning: If database prefix is enabled, this parameter must include the database prefix for the account.

Example: newname=username2
oldname
required
string <username>

The database user's current name.

Example: oldname=username
password
required
string

The database user's new password.

Example: password=12345luggage
cpuser
string

The database user's owner.

Example: cpuser=example
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/rename_postgresql_user
Request samples
whmapi1 --output=jsonpretty \
  rename_postgresql_user \
  oldname='username' \
  newname='username2' \
  password='12345luggage'
Response samples
application/json
{
  • "metadata": {
    • "command": "rename_postgresql_user",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}