Where are all the API docs?

betz

Verified User
Joined
Jun 23, 2009
Messages
12
Greetings!

Can someone tell me where to find all the directadmin api documentation is?
I know there is

http://www.directadmin.com/api.html
and
http://www.directadmin.com/search_versions.php?query=CMD_API

but it seems many is missing or just incorrect.
First of all, where can i find info about CMD_API_SITE_BACKUP ?
i find code on other sites, but nothing about restore and nowhere on DA.com
Also it seems that CMD_API_SELECT_USERS doesn't work when trying to delete a user account. It works when using CMD_SELECT_USERS, but then i also get html as return.

Is there a updated api documentation somewhere?

Kind regards,
Tom Behets
 
Hello,

Those 2 links are the sum of the documentation.

If you've found any errors in any of the items, please let me know so we can address them.

As for CMD_API_SITE_BACKUP, I searched for in the versions system and this is the link:
http://www.directadmin.com/features.php?id=512
it's #2 in the list.

The CMD_API_SELECT_USERS command works exactly the same as CMD_SELECT_USERS. The same internal code in DA is used. The only difference is the output.
http://www.directadmin.com/api.html#delete

To find out the differences between what you're passing in your script, and what your browser is passing, run DA in debug mode and you'll be able to see all of the POST and GET data. Compare the differences to see what you're missing.
Code:
cd /usr/local/directadmin
killall -9 directadmin
./directadmin b2000
John
 
Aah thanx for your quick answer!

When i start directadmin in debug mode, how can i start it normally after again?
Like this?

Code:
cd /usr/local/directadmin
killall -9 directadmin
./directadmin
 
Ok, sounds logic ^^

Another thing, i now have commands to create and restore a backup.
But for restoring a backup i need t o give the filename, is there a command to get all available backup files also?
 
I would like to add that I also am unable to delete a user through the API.

This is the error string I get back (I am passing everything as a GET request)

error=1&text=Cannot Execute Command&details=Empty post

The URL I am using is exactly the same as the browser uses (same params and order of params, same capitalization, etc) except I change "CMD_SELECT_USERS" to "CMD_API_SELECT_USERS".

this is what DA shows when run in debug when I issue the API command:

Debug set to level 2000
DirectAdmin 1.33.5
Accepting Connections on port 2222
Sockets::handshake - begin
Sockets::handshake - end
0: Authorization: Basic base64encoding
1: Connection: Keep-Alive
2: Host: <removed>:2222
InternalText::init(user)
InternalText::init(command)
Command::doCommand(/CMD_API_SELECT_USERS)
Command::doCommand(/CMD_API_SELECT_USERS) : finished
Command::run: finished /CMD_API_SELECT_USERS
 
Hello,

FYI, I changed your base64 user/pass to base64encoding, because you had essentially posted your user/pass to the forum ;) You're going to want to change your password for admin.

This is the related guide for getting more clear "debug" output from DA:
http://help.directadmin.com/item.php?id=293

Use the "| grep string" method to only show you the values you're passing, but update your version of DA first. 1.35.1 is the current version. 1.33.5 is getting a bit old.

As for your error, you've already answered your own question. This function requires the data to be sent via POST instead of GET. (Empty "post")

John
 
Back
Top