View Full Version : Change IP via API?
flamewalker
06-13-2011, 01:30 PM
Hey guys,
I have tried searching, and looking through the API's to no avail.
What I am looking for is to be able to modify the IP of an account. For instance, when they get an SSL certificate, they need their own IP. I am trying to be able to modify it via API.
I have successfully been able to code for changing the email, package, and password, and just need to be able to edit/change the IP.
TIA.
Jamey
I looked but wasnt able to find it anywhere. It might need to be a feature request unless someone else might know what it is.
gonz0
12-28-2011, 12:57 AM
I need that too - I have many IP addressess on my server and 'd like to change IP quickly. It is easy when you have only few accounts but when you have many it is not so easy to make it manually...
zEitEr
12-28-2011, 07:18 AM
GET or POST request to http ://DA_SERVER_HERE:2222/CMD_API_MODIFY_USER?user=USER_NAME_HERE&action=ip&ip=NEW_IP_HERE
http://www.directadmin.com/features.php?id=390
gonz0
12-28-2011, 09:46 AM
Thnx ... but I need it with the following command:
$sock->query('/CMD_API_ACCOUNT_USER', $arrtest );
.... next ...
$sock->set_login(username_here,password_of_the_user); //to work as an user not an admin
$usermodify = array(
'action' => 'ip',
'username' => username_here,
'ip' => new_ip_here,
'save' => 'submit'
);
$sock->query('/CMD_API_MODIFY_USER', $usermodify);
$result = $sock->fetch_parsed_body();
And I can't change an IP. What is the action - tested ip, action,customize and nothing worked.
zEitEr
12-28-2011, 10:27 AM
As it said here http://www.directadmin.com/features.php?id=390
CMD_API_MODIFY_USER
with the same options that CMD_MODIFY_USER uses.
<form action="CMD_MODIFY_USER" method="POST">
<input type=hidden name=action value=ip>
<input type=hidden name=user value="support">
<tr><td class=listtitle colspan=3>Change the User's IP</td></tr>
<tr><td class=list>Set IP to</td><td class=list align=center><select class=selectclass name=ip>
<option selected value="195.bbb.ccc.85">195.bbb.ccc.85 - support's current IP</option >
<option value="195.bbb.ccc.83">195.bbb.ccc.83 - Shared - Server</option >
<option value="195.bbb.ccc.86">195.bbb.ccc.86 - Shared</option >
<option value="195.bbb.ccc.94">195.bbb.ccc.94</option >
<option value="195.bbb.ccc.95">195.bbb.ccc.95</option >
</select ></td><td class=list><input type=submit value="Save"></td></tr>
</form>
And what result do you have there?
zEitEr
12-28-2011, 10:28 AM
$sock->set_login(username_here,password_of_the_user); //to work as an user not an admin
You should login as reseller, not the owner but the creator of the account for which you want to change IP.
gonz0
12-28-2011, 10:41 AM
Script is logged as a user with the set_login, after that trying to run the API command and got:
Error modifying username xxxxxxx on server new_ip_here
So I have tried many combinations with action => ip, customize, single ... no luck. I am not a good programmer so may be I don;t understand everything.
edit: I can see the status of the created username : user in DA.
zEitEr
12-28-2011, 10:53 AM
The script should login as a reseller, not the owner but the creator of the account for which you want to change IP.
gonz0
12-28-2011, 11:30 AM
The script should login as a reseller, not the owner but the creator of the account for which you want to change IP.
OK :) Now got it... the problem is that on my own dedicated server I don't use reseller's accounts. Every single/user account is created under "Resellers Level"
Is this possible to change IP from CLI ?
zEitEr
12-28-2011, 08:04 PM
Then your reseller is admin, and you should use admin's password.
gonz0
12-28-2011, 11:35 PM
Thx a lot for your patient support :D
Powered by vBulletin™ Version 4.0.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.