PDA

View Full Version : Java API


fransisco
01-12-2004, 05:04 AM
Hi everybody,

We are creating a Java Api to access directadmin panel and access many directadmins functions. We would like to know what you people think and have ideas which can improve the speed of production.

S2S-Robert
01-12-2004, 10:08 AM
What practical use would java have? I fail to grasp the specific benefits of having a java control panel, but that could be due to the fact I'm not a java programmer :D

l0rdphi1
01-13-2004, 09:13 AM
I can't say I see any benefit either. Anything done in Java related to a webpanel can be done in PHP, and PHP is more of a standard for such things. :)

fransisco
01-13-2004, 12:14 PM
Dear Friends,

Thank you for you valuable time in this forum. I just want to add that as a developer we have to consider developing functions for different languages. API is a model through which developers interact with 2 components. I asume a case in my hand in which the client has built a beautiful application in Java and now wants to plug in directadmin to it.
I as a developer would like to help the client and help him interact with DA since it is now ganing worldwide acceptance.

My request to all you flocks is ; instead of just saying why not PHP can anyone just come up and give me more suggestions since I have already started working on the JAVA API. We just dont want to waste any time.

Thanks again for a wonderful forum,
Fransisco

l0rdphi1
01-13-2004, 12:28 PM
What kind of suggestions are you after? For the PHP API I've only provided a simple gateway to "fake" all the <form>'s DA uses interally, and of course the PHP API works great for DA's documented APIs (http://www.directadmin.com/api.html).

fransisco
01-13-2004, 01:11 PM
Hi ,
I am looking for creating the auto login feature in JSP . We need to auto login and then call the CREATE functions.

I checked your class and it seems you have designed the method based on sockets.I would appreciate if you give me more info like how the baisc functionality is.


Thanks :)

l0rdphi1
01-13-2004, 04:46 PM
Well, here's an example that displays a list of all the users on a machine: http://www.l0rdphi1.com/junk/httpsocket/example.show_all_users.phps

Any of the HTML forms inside DA (create user, domain; anything) can be faked by changing the '/CMD_API_SHOW_ALL_USERS' part in the above example. Say you want to add a domain to user X's account:<?php

include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('yoursite.com',2222);

$sock->set_login('{X_username}','{X_password}');
$sock->set_method('POST');

$sock->query('/CMD_DOMAIN',
array(
'action' => 'create',
'domain' => '{X_new_domain}',
'ubandwidth' => 'unlimited',
'uquota' => 'unlimited',
'ssl' => 'ON',
'cgi' => 'ON',
'php' => 'ON',
'create' => 'Create'
));
$result = $sock->fetch_body();

echo $result;

?>Note that all tokens save for the CMD_API_* ones will return their normal in-DA HTML output.

l0rdphi1
01-13-2004, 04:58 PM
Originally posted by l0rdphi1
<?php [...]
$sock->set_login('{X_username}','{X_password}');
[...] ?>Actually, in place of the above code snip, it may be better to use:<?php
$sock->set_login('admin|{X_username}','{admin_password}');
?>Using that you won't have to keep users' passwords. :)