Page tree
Skip to end of metadata
Go to start of metadata

Overview

The creation process creates the transfer session.

In these examples, the following statements are true:

  • You have two servers: remote.example.com and hostname.example.com
  • You logged in to the local server with the cpsess########## security token.
  • The example account owns example.com, and you want to transfer it from the remote server to the local server.
  • The example.com domain is 123,456,789 bytes.
  • You want to transfer the package1 package from the remote server to the local server.
  • The root password for the remote server is luggage12345  

Create the transfer session

To create the transfer session, use one of the following functions:

https://hostname.example.com:2087/cpsess##########/json-api/create_remote_root_transfer_session?api.version=1&remote_server_type=cpanel&host=remote.example.com&port=22&user=root&password=12345luggage&transfer_threads=1&restore_threads=1&unrestricted_restore=1&copy_reseller_privs=0&compressed=0&unencrypted=0&low_priority=0

This function generates the following transfer session ID in the  transfer_session_id  return value:

 Click to view...

{
  "data": {
    "analyze_rawout":
 "Fetching information from remote host: \u201c10.1.100.35\u201d \u2026 
\u2026\nDone\nFetching information from remote host: 
\u201c10.1.100.35\u201d \u2026 \u2026\nDone\n",
    "create_rawout":
 "Basic credential check \u2026 \u2026\nDone\nFetching information from 
remote host: \u201c10.1.100.35\u201d \u2026 \u2026\nDone\nFetching WHM 
Version \u2026\nDone\nTesting \u201cvm5.docs.cpanel.net\u201d for 
transfer streaming support with password 
authentication....<strong>Streaming 
Supported</strong>\nRemote Server Type: \u201cWHM1130\u201d\n",
    "transfer_session_id": "vm5docscpanelcopya20140430200447f69g"
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "create_remote_root_transfer_session"
  }
}

In this example,  vm5docscpanelnoroo201402251939519hmy is the transfer session ID.

include_once '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_user = getenv('REMOTE_USER');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip , $root_user , $root_pass);
$xmlapi->set_debug(1);
$xmlapi->set_output('json');

$settings = array(
    'api.version'=>1, 
    'remote_server_type' => 'cpanel', 
    'host' => 'remote.example.com', 
    'port' => '22', 
    'user' => 'root', 
    'password' => 'luggage12345', 
    'transfer_threads' => '1', 
    'restore_threads' => '1', 
    'enable_custom_pkgacct' => '1', 
    'unrestricted_restore' => '1', 
    'copy_reseller_privs' => '0', 
    'compressed' => '0', 
    'unencrypted' => '0', 
    'low_priority' => '0'
);

$_result = $xmlapi->xmlapi_query('create_remote_root_transfer_session' , $settings);

print $_result;

This function returns the following transfer session ID as the  transfer_session_id value:

 Click to view...

{
  "data": {
    "analyze_rawout":
 "Fetching information from remote host: \u201c10.1.100.35\u201d \u2026 
\u2026\nDone\nFetching information from remote host: 
\u201c10.1.100.35\u201d \u2026 \u2026\nDone\n",
    "create_rawout":
 "Basic credential check \u2026 \u2026\nDone\nFetching information from 
remote host: \u201c10.1.100.35\u201d \u2026 \u2026\nDone\nFetching WHM 
Version \u2026\nDone\nTesting \u201cvm5.docs.cpanel.net\u201d for 
transfer streaming support with password 
authentication....<strong>Streaming 
Supported</strong>\nRemote Server Type: \u201cWHM1130\u201d\n",
    "transfer_session_id": "vm5docscpanelcopya20140430200447f69g"
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "create_remote_root_transfer_session"
  }
}

In this example, vm5docscpanelnoroo201402251939519hmy is the transfer session ID.

https://hostname.example.com:2087/cpsess##########/json-api/create_remote_user_transfer_session?api.version=1&unrestricted_restore=1&host=hostname.example.com&password=12345luggage

This function returns the following transfer session ID in the  transfer_session_id value:

 Click to view...

{
  "data": {
    "transfer_session_id": "vm5docscpanelnoroo201402251939519hmy"
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "create_remote_user_transfer_session"
  }
}

The transfer session ID is vm5docscpanelnoroo201402251939519hmy.

include_once '../xmlapi.php';

$ip = getenv('REMOTE_HOST');
$root_user = getenv('REMOTE_USER');
$root_pass = getenv('REMOTE_PASSWORD');

$xmlapi = new xmlapi($ip , $root_user , $root_pass);
$xmlapi->set_debug(1);
$xmlapi->set_output('json');

$settings = array(
    'api.version'=>1, 
    'host' => 'remote.example.com', 
    'password' => 'luggage12345',
);

$_result = $xmlapi->xmlapi_query('create_remote_user_transfer_session' , $settings);

print $_result;

This function returns the following transfer session ID in the  transfer_session_id value:

 Click to view...

{
  "data": {
    "transfer_session_id": "vm5docscpanelnoroo201402251939519hmy"
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "create_remote_user_transfer_session"
  }
}

In this example, vm5docscpanelnoroo201402251939519hmy is the transfer session ID.