Hi Seengee,
I see your point: Such a mechanism would be feature request. You're welcome to post your idea in the Feature Request forum.
I think there's some validity to what Vanessa is saying, though. For instance: if you had many, many WHM/cPanel boxes you'd probably used a centralized billing system for all the servers, otherwise keeping track of accounts on each server would be an overwhelming task. And depending on your desire or the billing software, it may be a requirement in the workflow that all your accounts had unique username across the entirety of your farm, not just any given server. It only makes sense then to use the billing system to automate account creation and management. In that scenario, you billing system would have the logic to keep track of account details; enough so to answer a 'check availability' type question. The billing system would use the APIs to perform CRUD as necessary on the server farm.
-OR- you could roll the feature yourself with some:
If you had only a handful of servers, you could make a script that aggregates a username list. I say only a handful cause this solution my not scale well, depending on your particular implementation.
You'd use the XML-API, the function 'listaccts'.
The query URL is simple:
Code:
https://10.1.1.1:2087/xml-api/listaccts
it would generate a response something like:
Code:
<listaccts>
<acct>
<disklimit>unlimited</disklimit>
<diskused>0M</diskused>
<domain>dave.com</domain>
<email>dave@test.test</email>
<ip>192.168.99.190</ip>
<maxaddons>*unknown*</maxaddons>
<maxftp>unlimited</maxftp>
<maxlst>unlimited</maxlst>
<maxparked>*unknown*</maxparked>
<maxpop>unlimited</maxpop>
<maxsql>unlimited</maxsql>
<maxsub>unlimited</maxsub>
<owner>root</owner>
<partition>home</partition>
<plan>default</plan>
<shell>/bin/bash</shell>
<startdate>10 Aug 10 15:03</startdate>
<suspended>0</suspended>
<suspendreason>not suspended</suspendreason>
<suspendtime></suspendtime>
<theme>x3</theme>
<unix_startdate>1281470609</unix_startdate>
<user>dave</user>
</acct>
</listaccts>
If you use the XML-API PHP client class, you code would look like this, only you'd have to loop/aggregate the results for the master list of what is not available.
Code:
include("xmlapi.php");
$ip = "10.1.1.1";
$root_user = "root";
$root_pass = "r00ts3cr3t!";
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($root_user, $root_pass);
$accounts = $xmlapi->listaccts();
// do something with the $accounts object....
Regards,
-DavidN