Hi
Is there any API for moving a cpanel user from another server ?
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.
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.
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:
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>fullbackup</func> </cpanelaction>
which will return something like:Code:<cpanelaction> <apiversion>1</apiversion> <module>Fileman</module> <func>listfullbackups</func> </cpanelaction>
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.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>
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.
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:
we get: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>
which could then be used without making baby Jesus cry.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>![]()
Maybe I should have started a new thread.
.. 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>
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.