Results 1 to 8 of 8

Thread: Restore cPanel account through API

  1. #1
    Member
    Join Date
    Apr 2007
    Posts
    9

    Default Restore cPanel account through API

    Hi there,


    I've developed a tool that backups cPane/cPanel account through reseller logins to an offsite server. I was wondering would there be a way through API to specify where the backup is stored and make cpanel restore by using either cPanel details or WHM details and user nameof cPanel?



    Thanks!

  2. #2
    BANNED
    Join Date
    Apr 2012
    Location
    Utah
    Posts
    117
    cPanel/WHM Access Level

    DataCenter Provider

    Default Re: Restore cPanel account through API

    There are API functions but depending on how you wrote your program, it might be easier just to call the shell scripts.

    /scripts/pkgacct -- script used to create a backup archive of an account
    /scripts/restorepkg -- script used to restore site backups

    By default, Cpanel looks for the backup archives in a number of different fixed locations (see Cpanel documentation) but most common place to put these files is in /home which is one of the locations on the built in search path to find the backup archives.

    Incidentally, the backup system in WHM / Cpanel uses the same search locations as the shell scripts for finding the backups.

  3. #3
    Member
    Join Date
    Apr 2007
    Posts
    9

    Default Re: Restore cPanel account through API

    I won't be able to run shell scripts, I need to do this over the API, I looked at the API docs and it seems only like I can do this from cpanel's own backups daily, weekly or monthly? can I do this by uploading or telling it what file to extract? All my backups are generated through the APIas well

  4. #4
    Member This forum account has been confirmed by cPanel staff to represent a vendor. KostonConsulting's Avatar
    Join Date
    Jun 2010
    Location
    Austin, TX
    Posts
    148
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Restore cPanel account through API

    Quote Originally Posted by saulyx View Post
    can I do this by uploading or telling it what file to extract?
    The XML/JSON API to restore an account will load the backup file from the backup destination set in WHM's 'Configure Backup' menu. You'll need to have the file present at the daily/weekly/monthly location within that backup destination for it to be used with the restore.
    Dave Koston
    Koston Consulting
    http://www.kostonconsulting.com

  5. #5
    Member
    Join Date
    Apr 2007
    Posts
    9

    Default Re: Restore cPanel account through API

    So what would be the process? Move the file (gzip) from myremote server to the cpanel's backup directory(or home?) and then run the api query? Is there anysamples of code floating about? As I can't find anything :s


    Thanks!

  6. #6
    Member This forum account has been confirmed by cPanel staff to represent a vendor. KostonConsulting's Avatar
    Join Date
    Jun 2010
    Location
    Austin, TX
    Posts
    148
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Restore cPanel account through API

    Quote Originally Posted by saulyx View Post
    So what would be the process? Move the file (gzip) from myremote server to the cpanel's backup directory(or home?) and then run the api query? Is there anysamples of code floating about? As I can't find anything :s


    Thanks!
    That's correct. You could use 'scp' to send the file to the remote server and then run the API command. I'm not aware of any code samples to do this specifically but you can use this PHP function: ssh2-scp-send.php
    Dave Koston
    Koston Consulting
    http://www.kostonconsulting.com

  7. #7
    Member
    Join Date
    Apr 2007
    Posts
    9

    Default Re: Restore cPanel account through API

    My real question would be about moving the file really, as backup server I can access via FTP only and the server I want to put the backup on I can only access via WHM Logins. Thats the issue, been looking for a way for few hours now. Is there a way?

  8. #8
    Member This forum account has been confirmed by cPanel staff to represent a vendor. KostonConsulting's Avatar
    Join Date
    Jun 2010
    Location
    Austin, TX
    Posts
    148
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Restore cPanel account through API

    Quote Originally Posted by saulyx View Post
    My real question would be about moving the file really, as backup server I can access via FTP only and the server I want to put the backup on I can only access via WHM Logins. Thats the issue, been looking for a way for few hours now. Is there a way?
    Using FTP to get the files shouldn't be an issue: PHP:FTP. However, I'm not aware of any way to upload files via WHM. If you're a reseller, this isn't going to happen as the backup locations are going to be in a location you can't access.
    Dave Koston
    Koston Consulting
    http://www.kostonconsulting.com

Similar Threads

  1. WHM account creation using the cpanel api
    By manigandan in forum cPanel Developers
    Replies: 4
    Last Post: 01-20-2011, 09:57 PM
  2. Replies: 2
    Last Post: 03-25-2010, 10:49 AM
  3. API Access Denied for cPanel Account
    By Nate_GC in forum cPanel Developers
    Replies: 4
    Last Post: 03-23-2010, 07:30 AM
  4. cPanel/WHM API - Create Account without DNS?
    By brunoredesul in forum cPanel Developers
    Replies: 2
    Last Post: 02-11-2010, 05:56 AM
  5. Account functions API and cpanel 11
    By 4u123 in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 07-06-2007, 04:31 AM