• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question Migrating only customers (but not subscriptions)

Server operating system version
CentOS Linux 7.9.2009 (Core) -> AlmaLinux 8.8 (Sapphire Caracal)
Plesk version and microupdate number
Plesk Obsidian Web Pro Edition Version 18.0.61 Update #4
According to this knowledgebase article:
https://support.plesk.com/hc/en-us/...ubscriptions-are-owned-by-Plesk-Administrator
If customers were not migrated, the only way to correct the issue is to delete all the subscriptions on the target server and rerun the migration.

This is not an option for me, as I'd already switched the destination server live when I discovered that the customers had not been migrated.

I don't have a problem manually reassigning subscriptions to their correct customers, but manually re-entering all the customer details is going to be time consuming.

I'm sure other people may have the scenario of wanting to sync customers between different servers without necessarily wanting to migrate subscriptions.

Is there any way to migrate or export/import just customers without making any changes to subscriptions on the destination server?
 
You could use the Plesk REST API to fetch your existing customers from your 'old' server and create them on you 'new' server. That would save you the time to manually add every customer on your new server. There is a caveat, mainly that customers passwords aren't export by the REST API.

You can then manually reassign the subscriptions to each customer.

I've created this Bash script as an example that you can adapt for your own use. You can use run it on the target server. Note that all customer accounts are created with the same password in this script as the existing passwords cannot be exported via the REST API. Use at your own risk.

Code:
#!/bin/bash

# Connect to source server
# Replace the basic authorization roken (YWRtaW46YWRtaW4=) with a base64 token of the
# admin user name and password (admin:mypassword) of the source server

JSON=$(curl -X 'GET' \
  'https://old.yourserver.com:8443/api/v2/clients' \
  -H 'accept: application/json' \
  -H 'authorization: Basic YWRtaW46YWRtaW4=')

# Create customers on the target server
# Replace the basic authorization roken (YWRtaW46YWRtaW4=) with a base64 token of the
# admin user name and password (admin:mypassword) of the target server

readarray -t clients < <(echo $JSON | jq -c '.[]')
for i in "${clients[@]}"; do
  curl -X 'POST' \
  'https://newserver:8443/api/v2/clients' \
  -H 'accept: application/json' \
  -H 'authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Content-Type: application/json' \
  -d "{

  \"name\": \"$(jq --raw-output '.name' <<< "$i")\",
  \"company\": \"$(jq --raw-output '.company' <<< "$i")\",
  \"login\": \"$(jq --raw-output '.login' <<< "$i")\",
  \"email\": \"$(jq --raw-output '.email' <<< "$i")\",
  \"locale\": \"$(jq --raw-output '.locale' <<< "$i")\",
  \"description\": \"$(jq --raw-output '.description' <<< "$i")\",
  \"password\": \"Cha22fngeme1Q**\",
  \"type\": \"customer\"
}"

done
 
Thanks. That worked. I modified it to work with a secret key as I don't have the root password on the new server, but was able to use the Plesk CLI to generate a secret key and used that instead.
 
Back
Top