WPX

Import an existing WordPress site

Changed on

This function imports an existing WordPress site to your cPanel account. The import runs in the background, so the function returns as soon as it queues the task.

Note:

  • This function has the following prerequisites:
    • The nova-wordpress entitlement.
    • The redirects, wp-toolkit, wp-toolkit-site-import, and mysql features.
  • Because the request carries the source WordPress credentials, use the POST method and do not place the source_password or source_user keys in the URL query string. The system rejects a request that uses another method, or that puts either key in the query string, before it reads the credentials, so they cannot leak into access logs, proxy logs, or browser history.
  • The background task can still fail after this function returns, for example when a feature is revoked in the meantime. Read the outcome from the WPX::get_task_progress function.
post/WPX/import_website

Request

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

Request body application/x-www-form-urlencoded

domainstring required

The destination domain for the import. The cPanel account must own the domain, and the domain must have its own document root. The system normalizes the value to lowercase.

overwrite1 | 0

Whether to overwrite an existing WordPress installation at the destination.

  • 1 - Overwrite.
  • 0 - Do not overwrite.
password_type'admin' | 'application'

The password type supplied in the source_password parameter.

  • admin - A WordPress administrator user password.
  • application - A service account password for a third-party integration.
source_passwordstring required

The WordPress user's password for the source site.

source_urlstring uri required

The URL of the source WordPress site to import.

Note:

  • The URL must use the HTTPS scheme.
  • The URL must resolve only to publicly routable addresses.
source_userstring required

The WordPress username for the source site.

Example request

{
  "domain": "example.com",
  "password_type": "application",
  "source_password": "EXAMPLE-PASSWORD-PLACEHOLDER",
  "source_url": "https://subdomain.example.net",
  "source_user": "admin_abcd"
}

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": "import_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