Articles in this section

Error accessing Plesk from WHMCS via API: Customer with external id 'whmcs_plesk_XX' is not found in panel

Plesk for Windows Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Symptoms

Cannot access Plesk from WHMCS via API as a customer or change password:

CONFIG_TEXT: Error code: 1013. Error message: Customer with external id 'whmcs_plesk_XX' is not found in panel.

CONFIG_TEXT: Error code: 1013. Error message: Customer with email 'johndoe@example.com' is not found in panel. Please contact your service provider.

Cause

The external_id entry is missing in psa.clients MySQL table.

Resolution

Note: if the issue appears on WHMCS integrated with Plesk Multi Server, this database update should be done on the management node side.

  1. Connect to the server via SSH

  2. Create a backup of psa database:

    # plesk db dump > psa.current.sql

  3. Access Plesk database from command line:

    # plesk db

  4. Update the following value:

    MYSQL_LIN: update clients set external_id='whmcs_plesk_XX' where login='johndoe';

    where whmcs_plesk_XX - should be replaced with ID from the error
    johndoe - should be replaced with login of the customer affected by the issue.

 

For several accounts

  1. List all orphaned client accounts (which has no external_id or it is invalid):

    MYSQL_LIN: select id,cname,pname,login from clients where parent_id = 1 and (external_id = NULL or external_id = '0' or external_id = '') and clients.type <> 'reseller';

  2. Create a file with all external_id extracted from WHMCS database.
  3. Log in to WHMCS database via PHPMyAdmin or via MySQL CLI and list all external_id:

    CONFIG_TEXT: SELECT tblhosting.username, mod_pleskaccounts.panelexternalid FROM mod_pleskaccounts, tblhosting where mod_pleskaccounts.userid = tblhosting.userid and tblhosting.username <> '';

Further steps for Linux
  1. Back up Plesk database:

    # plesk db dump psa > psa.current.sql

  2. Prepare a file with logins of the customers and external IDs separated by spaces:

    # cat customers.txt
    cus1 f8fc8a02-870a-483a-8de7-2f2cf6d16ace
    edjhlbrh 1d0fa7bc-ecd8-4689-9931-99146b22a657

  3. Take the ID and customer login from the customers.txt file and set IDs for clients with the appropriate logins:

    # while read i j; do plesk db "update clients set external_id='$j' where login='$i'"; done < customers.txt

  4. Check the result in psa.clients table:

    # plesk db "select pname,login,external_id from clients"
    +-------------------+----------+--------------------------------------+
    | pname | login | external_id |
    +-------------------+----------+--------------------------------------+
    | Administrator | admin | NULL |
    | SomeCustomer | cus1 | f8fc8a02-870a-483a-8de7-2f2cf6d16ace |
    | whmcsReseller | res | 1d0fa7bc-ecd8-4689-9931-99146b22a657 |
    +-------------------+----------+--------------------------------------+

Further steps for Windows
  1. Back up Plesk database:

    C:\> plesk db dump psa > psa_backup.sql

  2. Prepare a file with logins of the customers and external IDs separated by spaces:

    C:\> more customers.txt
    cus1 f8fc8a02-870a-483a-8de7-2f2cf6d16ace
    edjhlbrh 1d0fa7bc-ecd8-4689-9931-99146b22a657

  3. Take the ID and customer login from the customers.txt file and set IDs for clients with the appropriate logins:

    C:\> for /f "usebackq tokens=1,2" %a in (customers.txt) do plesk db "update clients set external_id='%b' where login='%a'"

  4. Check the result in psa.clients table:

    C:\> plesk db "select pname,login,external_id from clients"
    +-------------------+----------+--------------------------------------+
    | pname | login | external_id |
    +-------------------+----------+--------------------------------------+
    | Administrator | admin | NULL |
    | SomeCustomer | cus1 | f8fc8a02-870a-483a-8de7-2f2cf6d16ace |
    | whmcsReseller | res | 1d0fa7bc-ecd8-4689-9931-99146b22a657 |
    +-------------------+----------+--------------------------------------+

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.