Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    May 2007
    Posts
    23

    Default API for migrating a domain

    Hi

    Is there any API for moving a cpanel user from another server ?

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by vivekvsist View Post
    Hi

    Is there any API for moving a cpanel user from another server ?
    If you are looking to automate this rather than using the Transfers section of WHM, I recommend you refer to the Backups and Transfers presentation from the 2007 cPanel Conference for technical details of how that system works:

    http://www.cpanel.net/docs/seminar07..._Transfers.pdf

    This functionality is not implemented into our APIs at this time.

  3. #3
    Member
    Join Date
    May 2007
    Posts
    23

    Default

    Quote Originally Posted by cPanelDavidG View Post
    If you are looking to automate this rather than using the Transfers section of WHM, I recommend you refer to the Backups and Transfers presentation from the 2007 cPanel Conference for technical details of how that system works:

    http://www.cpanel.net/docs/seminar07..._Transfers.pdf

    This functionality is not implemented into our APIs at this time.
    I read it, But it is not what I need.
    I have a php script. I can connect to my server using root accesshash
    I want to move a cpanel account from another server where I have only the cpanel shared account permission.

    How can I do this via my php interface ?



    Also
    Main >> Transfers >> Copy an account from another server with account password

    is not working for me after you guys placed the XML API for this.
    Its always showing error

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by vivekvsist View Post
    I read it, But it is not what I need.
    I have a php script. I can connect to my server using root accesshash
    I want to move a cpanel account from another server where I have only the cpanel shared account permission.

    How can I do this via my php interface ?



    Also
    Main >> Transfers >> Copy an account from another server with account password

    is not working for me after you guys placed the XML API for this.
    Its always showing error
    There is no XML API function matching Transfers -> Copy an account from another server with account password. However, I will say, that is traditionally the most unreliable method of transferring an account.

    If this is only a single account, have you considered making a full site backup, transferring it to your server then restoring it? That method doesn't require any APIs and is more likely to work.

  5. #5
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Vivek,
    As David said, there really isn't a method for doing this implemented into cpanel. The way to do this will be tricky.

    To start:
    our transfer system work by generating the same backups that cpanel can create, these can be created through an API1 call called Fileman::fullbackup. Once this backup has been generated, it can be downloaded and moved to the new server.

    so, in order to generate the backup initially you'll need to run an XML call like, both of these can be called through:

    Code:
    <cpanelaction>
     <apiversion>1</apiversion>
     <module>Fileman</module>
     <func>fullbackup</func>
    </cpanelaction>
    once that is done you will need to poll the Fileman::listfullbackups function for the existance of the backup:

    Code:
    <cpanelaction>
     <apiversion>1</apiversion>
     <module>Fileman</module>
     <func>listfullbackups</func>
    </cpanelaction>
    which will return something like:

    Code:
    <cpanelresult>
      <module>Fileman</module>
      <func>listfullbackups</func>
      <type>event</type>
      <source>internal</source>
      <apiversion>1</apiversion>
      <data>
       <result>
         <div class="okmsg">
         <b>
         <a href="/download?file=backup-2.13.2009_10-31-56_cptest.tar.gz">backup-2.13.2009_10-31-56_cptest.tar.gz</a>
         </b>
         (Fri Feb 13 10:31:56 2009)
         <br/>
         </div>
         </result>
      </data>
    </cpanelresult>
    This will allow you to find the location and file name of the backup, in order to grab this url (the download url) it will have to be called by logging into the server via port :2083 using the user's username and either the user password or the root password.

    Now, once you have this downloaded, it will need to be put into the destination server's /home partition, you can choose your method to do this, I can't really help you there as I'm not a PHP programmer - but I'm sure it can be done easily enough.

    Once that has been done, you simply call a url in WHM:

    scripts5/quickrestore?user=USERNAME


    and the account should be restored.

    We have a perl script in /scripts that does just this ( /scripts/getremovecpmove ) and should work for your purposes. Also, it should tell you how different things need to be called so you can get this working.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  6. #6
    Member
    Join Date
    Jul 2009
    Location
    Houston, Texas
    Posts
    17

    Red face

    I apologize for the thread necromancy, but I figure since there's already a thread mentioning and giving examples of how to get a list of the backups via 'listfullbackups' I may as well use it.

    The actual XML returned by the listfullbackups API call has me scratching my head, though.

    I'm trying to parse the XML returned by the call, however since there are HTML tags in the cpanelresult->data->result element they get parsed as XML nodes instead of as the actual plain-text that I assume they're supposed to be.

    Any chance of having the 'result' node's text returned in a CDATA section instead so that the 'plain text/HTML' portion is left intact by XML parsers? So instead of:

    Code:
    <cpanelresult>
      <module>Fileman</module>
      <func>listfullbackups</func>
      <type>event</type>
      <source>internal</source>
      <apiversion>1</apiversion>
      <data>
       <result>
         <div class="okmsg">
         <b>
         <a href="/download?file=backup-2.13.2009_10-31-56_cptest.tar.gz">backup-2.13.2009_10-31-56_cptest.tar.gz</a>
         </b>
         (Fri Feb 13 10:31:56 2009)
         <br/>
         </div>
         </result>
      </data>
    </cpanelresult>
    we get:

    Code:
    <cpanelresult>
      <module>Fileman</module>
      <func>listfullbackups</func>
      <type>event</type>
      <source>internal</source>
      <apiversion>1</apiversion>
      <data>
       <result>
         <![CDATA[<div class="okmsg">
         <b>
         <a href="/download?file=backup-2.13.2009_10-31-56_cptest.tar.gz">backup-2.13.2009_10-31-56_cptest.tar.gz</a>
         </b>
         (Fri Feb 13 10:31:56 2009)
         <br/>
         </div>]]>
         </result>
      </data>
    </cpanelresult>
    which could then be used without making baby Jesus cry.

  7. #7
    Member
    Join Date
    Jul 2009
    Location
    Houston, Texas
    Posts
    17

    Default

    Maybe I should have started a new thread.

  8. #8
    Member
    Join Date
    Jul 2009
    Location
    Houston, Texas
    Posts
    17

    Default

    .. Or alternatively.. make it return an actual XML representation of the information, something like:

    Code:
    <cpanelresult>
      <module>Fileman</module>
      <func>listfullbackups</func>
      <type>event</type>
      <source>internal</source>
      <apiversion>1</apiversion>
      <data>
        <result>
          <backup>
            <status>ok</status>
            <filename>backup-2.13.2009_10-31-56_cptest.tar.gz<filename>
            <link>/download?file=backup-2.13.2009_10-31-56_cptest.tar.gz</link>
            <date>Fri Feb 13 10:31:56 2009</date>
          </backup>
        </result>
      </data>
    </cpanelresult>

  9. #9
    Member
    Join Date
    Jul 2009
    Location
    Houston, Texas
    Posts
    17

    Default

    Bump.. in the hopes of seeing some kind of reply or acknowledgment.

  10. #10
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by That1Swede View Post
    Bump.. in the hopes of seeing some kind of reply or acknowledgment.
    You've brought up a valid point and we've been discussing this internally for a few days now. We do intend to resolve this issue, but we're still exploring various possible options. I have no ETA on when this issue will be resolved, but we are very mindful of the issue you have brought to our attention.

Similar Threads & Tags
Similar threads

  1. Bulk Domain Park API?
    By cpisites in forum cPanel Developers
    Replies: 1
    Last Post: 05-23-2010, 07:03 AM
  2. Migrating in use domain to new account
    By Custodis in forum Data Protection
    Replies: 6
    Last Post: 05-26-2009, 09:39 PM
  3. How to get the main domain through the cPanel API
    By mberchtold in forum cPanel Developers
    Replies: 4
    Last Post: 04-02-2009, 01:34 PM
  4. problem after migrating the domain from other server
    By Kailash1 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-28-2008, 03:39 AM
  5. Problem with migrating from Alab*nza - cant ID domain name
    By bhorton in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 01-16-2008, 10:47 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube