Difference between revisions of "AWBS API"
(→Return and Options =) |
(→Sample cURL Post) |
||
Line 17: | Line 17: | ||
$data="command=adduser&help=1&accesskey=mykey"; | $data="command=adduser&help=1&accesskey=mykey"; | ||
− | |||
$ch = curl_init(); | $ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
curl_setopt($ch, CURLOPT_POST, 1); | curl_setopt($ch, CURLOPT_POST, 1); | ||
curl_setopt($ch, CURLOPT_POSTFIELDS, "$data"); | curl_setopt($ch, CURLOPT_POSTFIELDS, "$data"); | ||
− | curl_setopt($ch, CURLOPT_URL, "https://www.yoursite.com/interface.php"); | + | curl_setopt($ch, CURLOPT_URL, "<nowiki>https://www.yoursite.com/interface.php</nowiki>"); |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
Revision as of 09:06, April 1, 2010
Available Commands
Available Commands: adduser, addhosting, adddomain, suspendhosting, unsuspendhosting, cancelhosting, addhostingpackage, addhostingserver, resetpassword, checkserverstats, checkapi, addinvoice, getcart, checkdomain, getuser, payinvoice, updatecc, verifyuser
Note: checkserverstats will return a list of open/pending items separated by a pipe (|) character. helpdesk|others|reminders|contact_form|package_queue|users
USAGE INSTRUCTIONS
- Edit your Extended System Config and allow API access from your IP in the remote_list field. Note: Each allowed IP is separated by a | (pipe)
- Set your Private Key in AWBS System Setup/System Options.
The API currently accepts HTTP POST only.
Sample cURL Post
$data="command=adduser&help=1&accesskey=mykey"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "$data"); curl_setopt($ch, CURLOPT_URL, "https://www.yoursite.com/interface.php"); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 15); $ret = curl_exec($ch); curl_close($ch);
Return and Options
Posting help=1 will get you help on the function sent in the command.
When not sending help=1, you will receive either a "SUCCESS" response, or if the call failed, you will receive an "ERROR,error description" response.
You can also send the &altout=1 command. This will cause the api to return the insert_id for sql injections instead of the usual SUCCESS. Sending &checkapi=1 will return SUCCESS if you validate on the api (and pass ip check).