Direct Admin API

The last few weeks I have been working with the Direct Admin API for a new android application. Badly enough the direct admin API is just one large pain to work with, there are several issues with it, and they all cause a general pain really.

The first thing is that there is no real documentation about it. At the Direct Admin site they have some documentation about the API, however theyself say already that it is a incomplete list:

Listing of new API commands that might not be listed on this page.

so that means if you want to implement as much as possible features in something (So basicly copying the control panel itself, what iam actually doing :)) you will need to search around in the version system to get all posibilities from the API. And badly enough, not all features from the control panel have API calls as well (And it should be no problem at all to have for all calls a API call as well, as it is, according to them, the same code except a different output).

The second issue is the data you get back. The current standard is to use something like JSON or XML, or any other standard that can be easly parsed. However they use a basic name value pair, with the possibility to use arrays in there as well. In php this might be easy to get parsed (It requires actually some lines of code, while with other standards it can be done lots easier), in other language it makes parsing a pain. Right now to get a real value from the returned data I have around 250LOC to just parse the output and get it into something usefull, while with JSON it would cost me around 50LOC if I haven’t a base JSON class (With the JSON class it actually is 5LOC to parse it into something useful, however the class is a bit larger). If you ask the Direct Admin staff a feature request to change this you dont hear anything at all, so it seems they just dont want to change it in something way more usefull as the current implementation.

The thirth issue is the inconsistency with some calls. For some calls you dont need to provide a action if you just want to get a list of data, while for other you need to specify this as action. You cant just copy the code, you will need to make sure the API call you make is not different from the other.
The returned data is in some cases different as well, and you cant just combine code for different API calls. Badly enough this is kinda hard to fix as it will mean breaking backwards compatible, however, the API calls that differ from each other are mostly added later with new requirements.

Luckily iam nearly done with this API, as it really is causing me a bunch of headaches due to the design of the API.

1 thought on “Direct Admin API

  1. Hi,
    I am just trying implement this DA API using php.

    And failing to even display results of any call.

    There is not good example or help available for less skilled developers like me.

    Can you pls tell me how can I print list[].

    This is creating pain in my head. Pls help me.

    Thanks & Regards

Leave a Reply

Your email address will not be published. Required fields are marked *