Java API

fransisco

New member
Joined
Jan 12, 2004
Messages
3
Location
Nashik
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.
 
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
 
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. :)
 
Developer demands.....

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
 
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.
 
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 :)
 
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:
<?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.
 
Last edited:
l0rdphi1 said:
PHP:
<?php [...]
$sock->set_login('{X_username}','{X_password}');
[...] ?>
Actually, in place of the above code snip, it may be better to use:
PHP:
<?php
$sock->set_login('admin|{X_username}','{admin_password}');
?>
Using that you won't have to keep users' passwords. :)
 
Good day!
I'm trying to make JAVA-class in same style as it exists in PHP.

I can publish some code if it is interesting for some one, but I stopped on simple account creation, can't understand why...
Here is a log message I see on the server, DA is in debug mode:

Sockets::handshake - begin
Sockets::handshake - end
/CMD_API_ACCOUNT_USER
0: Accept-Encoding: gzip,deflate
1: Authorization: Basic XXXXXXX
2: Connection: Keep-Alive
3: Content-Length: 202
4: Content-Type: application/x-www-form-urlencoded; charset=UTF-8
5: Host: XX.8.35.XX:2222
6: User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_222)
Post string: add=Submit&password=qrZ2hqNR8ekGCyAU&package=newpackage&domain=1311505852directadmin1.uz&ip=XX.8.35.XX&action=create&password2=qrZ2hqNR8ekGCyAU&plan&email=info%40directadmin1.com&notify=no&username=user1
auth.authenticated
Plugin::addHooks: start
Plugin::addHooks: end
Command::doCommand(/CMD_API_ACCOUNT_USER)
Dynamic(api=1, error=1):
text='Unable to Create User'
result='The username ,password and email is required'
Command::doCommand(/CMD_API_ACCOUNT_USER) : finished
Command::run: finished /CMD_API_ACCOUNT_USER

Does anybody know Why I'm getting 'The username ,password and email is required', same time it is provided in "Post string" ?

Thanks
 
Sorry, I found the reason, I'm sending "password", but needs to send "passwd"
 
Back
Top