im trying to obtain a xml feed from my cpanel though API. I have tried several methods (see below) to pass the authorization to obtain the xml feed.
In my browser i can get the feed through the following way:
http://user:pass@domain.com:2086/xml-api/listaccts?
The feed example from the server:
<listaccts>
<acct>
<disklimit>2500M</disklimit>
<diskused>56M</diskused>
<domain>domain.com</domain>
<email>dot@domain.com</email>
<ip>xx.xx.xx.xx</ip>
<max_defer_fail_percentage>unlimited</max_defer_fail_percentage>
<max_email_per_hour>unlimited</max_email_per_hour>
<maxaddons>*unknown*</maxaddons>
<maxftp>5</maxftp>
<maxlst>*unknown*</maxlst>
<maxparked>*unknown*</maxparked>
<maxpop>25</maxpop>
<maxsql>1</maxsql>
<maxsub>5</maxsub>
<min_defer_fail_to_trigger_protection>5</min_defer_fail_to_trigger_protection>
<owner>root</owner>
<partition>home</partition>
<plan>Basic</plan>
<shell>/usr/local/cpanel/bin/noshell</shell>
<startdate>13 Feb 17 07:05</startdate>
<suspended>0</suspended>
<suspendreason>not suspended</suspendreason>
<suspendtime/>
<theme>x3</theme>
<unix_startdate>1361109935</unix_startdate>
<user>xxxxxxxx</user>
</acct>
</listaccts>
My Application script:
<s:HTTPService id="clientList" method="GET" resultFormat="e4x"/>
In Scripts:
[Bindable]
private var clientInfo:Object = new Object();
private function clients(event:Event):void{
clientList.url = 'http://' +loginUsername.text
clientList.url += ':' + loginPassword.text
clientList.url += '@' + loginServer.text;
clientList.url += ':2086/xml-api/listaccts?';
clientList.addEventListener("result", clientResult);
clientList.addEventListener("fault", clientFault);
clientList.send();
CursorManager.setBusyCursor();
}
public function clientResult(event:ResultEvent):void {
clientInfo = clientList.lastResult.acct;
CursorManager.removeBusyCursor();
}
public function clientFault(event:FaultEvent):void {
var faultstring:String = event.fault.faultString;
Alert.show("Unable to obtain client list","Error");
CursorManager.removeBusyCursor();
}
What am i doing wrong, i keep getting the error (Unable to obtain client list), i think i could be trying the authentication way i use.