WPX

Start a new WordPress installation on a domain

Changed on

This function starts a new WordPress installation on a domain that the caller owns. The installation runs in the background, so the function returns as soon as it queues the task.

Note:

  • Poll progress with get_task_progress and the returned install_id value. That works with a cPanel API token, unlike the sse_url stream, which needs an interactive cPanel session.
  • A domain that already has a WordPress installation is not an error. The call succeeds with the status field set to collision and lists the existing installations, and it queues nothing. To replace the existing site, call remove_installation for each entry in the existing_installations field, then call this function again.
  • The data.status field reports the outcome of this call. Do not confuse it with the result.status field, which reports whether the call itself succeeded.
  • This function needs the redirects and mysql features in addition to the wp-toolkit feature that the whole module needs. It also refuses the call when the account has too little free disk space, or when the account already holds as many WordPress websites as its plan allows.
  • The background task can still fail after this function returns, for example when a feature is revoked in the meantime. Read the outcome from get_task_progress.
post/WPX/create_website

Request

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

Request body application/x-www-form-urlencoded

domainstring required

The domain to install WordPress on. The cPanel account must own the domain, and the domain must have its own document root. The system normalizes the value to lowercase.

titlestring

The WordPress site title. When you omit this parameter, the system uses the domain name as the title. The system rejects a title longer than 253 characters or one that holds control characters, but it does that in the background task, not in this call: an invalid title still returns a successful status, then fails the installation. Read the failure from get_task_progress.

Example request

{
  "domain": "example.com",
  "title": "My Blog"
}

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": "create_website",
  "module": "WPX",
  "result": {
    "data": {
      "blocked_by": [
        "system_default"
      ],
      "domain": "example.com",
      "domain_package": "ea-php73",
      "domain_version": "7.3",
      "domain_version_source": "domain",
      "domain_version_vhost": "example.com",
      "effective_version": "7.3",
      "existing_installations": [
        {
          "id": 17,
          "url": "https://example.com"
        }
      ],
      "install_id": "1784237244-988110-12345",
      "required_version": "7.4",
      "sse_url": "/sse/UserTasks/00000000_63d7f020927f8f/wpx_install_1784237244-988110-12345.log",
      "status": "running",
      "system_default_package": "ea-php73",
      "system_default_version": "7.3",
      "task_id": "00000000/63d7f020927f8f"
    },
    "metadata": {
      "transformed": 1
    },
    "status": 1
  }
}

Changes

    • warning

      added the new unsupported_php enum value to the // response property for the response status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      endpoint added