WPX

Update WordPress administrator password

Changed on

This function sets a new password for a WordPress administrator of an installation that the caller owns.

Note:

  • Over HTTP this function accepts only the POST method, and it rejects any request that carries a password key in the URL query string. It checks both before it reads the password, so the password cannot reach an access log, a proxy log, or the browser history. The Perl bindings and the uapi command-line tool set no request method and no query string, so they are unaffected.
  • The system passes the password to WordPress through a file that only the caller can read, so it never appears in a process list, in the process environment, or in the WordPress Toolkit logs.
  • The system applies no password-strength rule of its own. Any non-empty value is accepted.
  • The system verifies that the caller owns the installation before it changes anything.
post/WPX/change_admin_password

Request

  • Base URL
    https://cpanel-server.tld:2083/execute
  • Auth
    HTTP basic

Request body application/x-www-form-urlencoded

idinteger required

The WordPress Toolkit installation id, as returned in the wptk_id field of list_websites.

loginstring

The WordPress administrator login to change. Omit this parameter only when the installation has exactly one administrator, and the system targets that administrator. When supplied, it must name an existing administrator of that installation. Call get_admin_account to list the available logins.

passwordstring required

The new WordPress administrator password. Send this parameter in the request body. The system rejects the call when a password key appears in the URL query string.

Example request

{
  "id": 17,
  "login": "admin_abcd",
  "password": "EXAMPLE-PASSWORD-PLACEHOLDER"
}

Response

The HTTP request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "change_admin_password",
  "module": "WPX",
  "result": {
    "data": {
      "changed": 1,
      "id": 17,
      "login": "admin_abcd"
    },
    "metadata": {
      "transformed": 1
    },
    "status": 1
  }
}

Changes