
Originally Posted by
kgp43
Its my own server, got root access.
Possible to point to in the right direction?
Sure, to create a database using our APIs, it's an API1 call as used in:
/usr/local/cpanel/base/frontend/x3/sql/addb.html (there's only 2 d's)
The actual function call in that source is:
Code:
<cpanel Mysql="adddb($FORM{'db'})">
Meaning, to create a database named example in raw API1 code, you would use:
Code:
<cpanel Mysql="adddb(example)">
Note, the username_ prefix will be automatically added, so try to keep your database names to 7 characters or less.
Now, to call this from outside the cPanel interface, we'll use the XML API. A sample for calling API1 functions with arguments can be found at:
http://www.cpanel.net/plugins/xmlapi/cpanel.html
The URL to call to create a database named "example" for a user with username "cPanelUser" would be:
https://server:2087/xml-api/cpanel?user=cPanelUser&xmlin=<cpanelaction><module>Mysql</module><func>adddb</func><apiversion>1</apiversion><args>example</args></cpanelaction>
There are code samples around these forums for helping with the XML-API and API1/API2. If you desire swifter responses from me, please send an email to sales@cpanel.net with ATTN: DavidG in the subject line.