WPX

Return WordPress administrator account

Changed on

This function returns the WordPress administrator account details for an installation that the caller owns: the administrator logins, the first administrator's display name and email address, and the login URL. The WordPress administration settings form uses it to fill in current values.

Note:

  • The stored WordPress password is never returned. Use change_admin_password to set a new one, and get_credentials to sign in without a password.
  • The system verifies that the caller owns the installation before it reads anything.
  • When the installation has no WordPress administrator, the current_user_id field is null, the other text fields are empty strings, and the available_logins field is an empty array. A failure to read the administrator list is different: it returns a failure status with a message in the errors field.
  • The active WordPress language is not part of this response. Use set_language to change it.
get/WPX/get_admin_account

Request

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

Query parameters

idinteger required

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

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": "get_admin_account",
  "module": "WPX",
  "result": {
    "data": {
      "available_logins": [
        "admin_abcd"
      ],
      "current_display_name": "Admin",
      "current_email": "admin@example.tld",
      "current_login": "admin_abcd",
      "current_user_id": 1,
      "login_url": "https://blog.example.com/wp-login.php"
    },
    "metadata": {
      "transformed": 1
    },
    "status": 1
  }
}

Changes