You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • WHM API 1 Functions - start_local_cpmove_restore
Skip to end of metadata
Go to start of metadata

Description

This function performs a full restoration of a single cPanel account from a backup file.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/start_local_cpmove_restore?api.version=1&cpmovepath=%2Fhome%2Fcpmove-newacct.tar.gz&overwrite=1&dedicated_ip=0&delete_archive=0&restricted=0&update_a_records=all&username=example
 Command Line
whmapi1 start_local_cpmove_restore cpmovepath=/home/cpmove-newacct.tar.gz overwrite=1 dedicated_ip=0 delete_archive=0 restricted=0 update_a_records=all username=example


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "data" : {
      "transfer_session_id" : "example202003301756425ugO"
   },
   "metadata" : {
      "result" : 1,
      "reason" : "OK",
      "command" : "start_local_cpmove_restore",
      "version" : 1
   }
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
cpmovepath

string

Required

A filepath that contains the account's cpmove tarball or the directory path that contains the extracted cpmove tarball.

Note:

You can use the pkgacct script to create an account cpmove tarball.

A valid filepath./home/cpmove-newacct.tar.gz
dedicated_ip

Boolean

Whether to assign the account a dedicated IP address.

Note:

The system must have an available IP address.

This parameter defaults to 0.

  • 1 — Assign.
  • 0 — Do not assign.
0
delete_archiveBoolean

Whether to delete the cpmove file or directory after the system completes the account restoration. This is the filepath passed in the cpmovepath parameter.

This parameter defaults to 0.

  • 1 — Delete.
  • 0 — Do not delete.
0
mail_locationstring

The server on which the account's email will reside after the system completes the transfer.

Note:

The system will use the .local option if:

  • The system cannot use the cPanel & WHM linked server node when you call the .existing option.
  • The cPanel & WHM linked server node's ALIAS value is invalid.

This parameter defaults to .existing.

  • .local — The local server.
  • .existing — Use the location defined in the account's backup data.
  • ALIAS — A remote cPanel & WHM linked server node's alias. For example, the example-alias for the servernode.example.com domain.
example-alias
overwrite

Boolean

Whether to overwrite an existing account on the server, if one exists.

This parameter defaults to 0.

  • 1 — Overwrite.
  • 0 — Do not overwrite.
1
restricted

Boolean

Whether to perform a restricted restore for the account. The system will perform security checks on the backup file. If you do not trust the source of the account backup with root access to your server, use this parameter to protect your server.

Important:

  • This parameter is experimental. Do not consider it as an effective security control.
  • This parameter only allows restored accounts to use the noshell or jailshell environments. If the account uses a different shell, the system will set the account to use the noshell environment.
  • If there is an issue with the backup file, the system will not restore that part of the backup file. It will also adds a warning to the log file.
  • If the account owns PostgreSQL® databases, your server must use PostgreSQL version 8.4 or newer.

This parameter defaults to 0.

  • 1 — Perform a restricted restore.
  • 0 — Do not perform a restricted restore.
0
update_a_records

string

Whether to perform one of the following actions to the account's A records:

  • all — Replace all instances of the original server's IP address with the new server's IP address.
  • basic — Replace only the basic cPanel-provided A records.

This parameter defaults to all.

  • all
  • basic
all
usernamestring

The username to give to the restored cPanel account.

This parameter defaults to the username in the backup file's name.

A valid username.example

Returns

ReturnTypeDescriptionPossible valuesExample
transfer_session_idstringThe background transfer process ID.

A valid ID.

example202003301756425ugO