PDA

View Full Version : Cmd_db


Marckus_e
03-19-2004, 06:04 AM
Hi!

Do i need to use the domain value when sending data or is it enough to use only the rest?

name, username and password that is.

Best regards
Marcus

l0rdphi1
03-19-2004, 06:08 AM
CMD_API_DB doens't need a domain. The other info is good enough.

Marckus_e
03-19-2004, 06:09 AM
Thanks for the quick answer!

/Marcus

Marckus_e
03-19-2004, 06:28 AM
I am trying to create a db with my user

and i get

The request you've made cannot be executed because it does not exist in your authority level

Code

$sock = new HTTPSocket;

$sock->connect('ssl://ipnumber',2222);
$sock->set_login($dauser,$dapwd);

$sock->set_method('POST');

$sock->query('/CMD_API_DB',
array('action' => 'create',
'name' => $slices[2],
'user' => $dauser,
'passwd' => $dapwd,
'passwd2' => $dapwd2
));
$result = $sock->fetch_body();

l0rdphi1
03-19-2004, 06:45 AM
Actually, yes, that's a problem. Maybe we can get John to fix this for the next version - Users should be able to manipulate themselves using any applicable APIs.

This is what I'm using in iTron: $socket->set_login("{admin}|{user}","{admin_passwd}");

Marckus_e
03-19-2004, 06:50 AM
So i need to login as admin | user and adminpassword?

Best regards
Marcus

l0rdphi1
03-19-2004, 07:52 AM
Yes, say we have an admin named super (whose password is cheese) and a user named frank.

We'd use: super|frank:cheese

Marckus_e
03-19-2004, 07:56 AM
$sock->set_login('admin|user,'adminpwd');

That is correct right?

Still getting error.

Best regards
Marcus

l0rdphi1
03-19-2004, 09:48 AM
Yeah, I meant super|frank:cheese as:

$obj->set_login("super|frank","cheese");

DirectAdmin Support
03-19-2004, 10:37 AM
Hello,

There is no CMD_API_DB ... only CMD_API_DATABASES

John

Marckus_e
03-19-2004, 11:20 AM
CMD_API_DATABASES does what?

/Marcus

DirectAdmin Support
03-19-2004, 11:29 AM
http://www.directadmin.com/api.html#user_apis

CMD_API_DATABASES is listed starting the 5th one down.. and there are 3 of them. They used for listing databases, creating databases, and deleting databases.

John

Marckus_e
03-19-2004, 11:37 AM
Thank you for the quick support!

Just what i was looking after and missed, sorry!

/Marcus

l0rdphi1
03-19-2004, 12:18 PM
Shoot; yes, it should be CMD_API_DATABASES. Looked right over that :)

Marckus_e
03-22-2004, 12:01 AM
Problems,

i have changed to CMD_API_DATABASES, have the correct login ('admin|user','adminpwd') and all the values that are needed and still get The request you've made cannot be executed because it does not exist in your authority level

$sock = new HTTPSocket;

$sock->connect('ssl://ipnumber',2222);
$sock->set_login('admin|user','adminpwd');

$sock->set_method('POST');
$sock->query('/CMD_API_DATABASES',

array('action' => 'create',
'name' => $slices[2],
'user' => $dauser,
'passwd' => $dapwd,
'passwd2' => $dapwd ));

$result = $sock->fetch_body();
echo $result;

Also tried the username, usrpwd but no difference.

Best regards
Marcus

Marckus_e
03-23-2004, 12:45 AM
Any ideas?

I have tried all kinds of different logins and changes but doesn't work so far.

Best regards
Marcus

DirectAdmin Support
03-23-2004, 10:13 AM
Hello,

Is the / added automatically... try removing the / before the /CMD_API_DATABASES.

John

Marckus_e
03-23-2004, 11:53 AM
It doesn't create the DB then, if i echo the result i get

Error: document not found

i removed the / before CMD_API_DATABASES

Best regards
Marcus

DirectAdmin Support
03-23-2004, 12:08 PM
What happens when you run the command from your browser:

http://domain.com:2222/CMD_API_DATABASES

You should get a list of databases. Also which version of DA are you running? It's only available in 1.21.2.

John

Marckus_e
03-23-2004, 12:11 PM
Thanks, Runnign 1.21.0 .. Will tell the admin to update that tomorrow!

Sorry for the problems i have been dragging up here..

THanks for the fast help!

Best regards
Marcus

DirectAdmin Support
03-24-2004, 09:57 AM
If the backup system has fewer bugs, then I can force out 1.21.3 when it comes out.

John