I build API's on the regular and I've always found that SOAP is the harder one between itself and REST for new comers. I've just built a API for A2Billing but a bit differently. Everything A2 Billing does is stored in the MySQL database so I decided to build my own API (on a separate server) and simply have it query/update/input data into the MySQL database that powers my A2Billing installation in the cloud. Many will warn against this because directly changing the database is always risky, but I'd like to point out that the SOAP API built into A2 does the exact same thing. Make sure you do ample testing before changing anything important.
Here is a quick example of how you can do this. Don't forget to allow remote access to your MySQL server. When I get some time I may built this out further and make all the functions available in a ZIP, I'm currently not even finished with all the functions though.
<?
## CONNECT TO YOur A2BILLING SQL SERVER
$link = mysql_pconnect("166.44.14.344","root","yourpassword")
or die("Could Not connect! Error: " .mysql_error());
mysql_select_db("mya2billing",$link)
or die("Could not open database!
Error: " .mysql_error());
## GENERATE ACCOUNT CREDENTIALS
$digits = 10; $username = rand(pow(10, $digits-1), pow(10, $digits)-1); // Ganerate username
$digits = 15; $alias = rand(pow(10, $digits-1), pow(10, $digits)-1); // Generate alias
$password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') , 0 , 20); // Generate a password
## CREATE THE CUSTOMER/CARD
//Be sure to change values here so they match with you rate card etc.
mysql_query("INSERT INTO cc_card (creationdate,expirationdate,enableexpire,expiredays,username,useralias,uipass,credit,tariff,id_didgroup,activated,status,lastname,firstname,country,zipcode,email,inuse,simultaccess,currency,nbused,typepaid,creditlimit,voipcall,sip_buddy,iax_buddy,language,id_campaign,initialbalance,invoiceday,id_timezone,max_concurrent)
values (NOW(),'2022-01-01 00:00:00','0','0','".$username."','".$alias."','".$password."','50.00','1','-1','f','1','".$lastname."','".$firstname."','USA','".$zipcode."','
[email protected]','0','1','USD','0','0','0','0','1','1','en','-1','0.00','1','67','2')");
$a2billing_id = mysql_insert_id();
$newaccount = $a2billing_id;
## CHECK IF THE CUSTOMER/CARD WAS CREATED, IF SO ADD THE SIP CREDENTIALS (sip buddy)
if ($newaccount != "") {
$secret = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') , 0 , 12); //Create the secret
mysql_query("INSERT INTO cc_sip_buddies (id_cc_card,name,accountcode,regexten,amaflags,canreinvite,context,dtmfmode,host,nat,qualify,secret,type,username,disallow,allow,cancallforward)
values ('".$newaccount."','".$username."','".$username."','".$username."','billing','YES','a2billing','RFC2833','dynamic','yes','no','".$secret."','friend','".$username."','ALL','ulaw,alaw,gsm,g729','yes')");
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
$a2billing_sip_id = mysql_insert_id();
$newsip = $a2billing_sip_id;
## OUTPUT THE XML
print <<<A2RETURN
<return>
<createcustomer>
<accountid>$newaccount</accountid>
<sipid>$newsip</sipid>
<username>$username</username>
<password>$secret</password>
</createcustomer>
</return>
A2RETURN;
?>