• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

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