Using the GetAccountByName method
Hi, following up on the above post: I am building an API between WHMcs and Sitebuilder. I have automatic user/site creation working. Now I wish to delete a certain account.
However, I am receiving this error concerning the DeleteAccount method. Listed below this error message is the code where I am using that method.
Type: SoapFault
Message: Action has been failed. list of users is empty
Fault code: ERROR_ACTION_FAILED
Details: list of users is empty
File: /home/goodhost/public_html/billing3/includes/actionhooks.php
Line: 352
Code: 0
$struct = new stdClass();
$result = new stdClass();
$result2 = new stdClass();
print $vars["username"];
$accountService = $this->_getWebService('/AccountWebService.asmx?WSDL');
// first we must search to see if the username exists as a site in sitebuilder.
$struct->username = $vars["username"];
$result = $accountService->GetAccountByName(new SoapVar($struct, SOAP_ENC_OBJECT));
$accountId = $result->UserAccount->AccountId;
print "<p>";
print $accountId;
$delsite = new stdClass();
$delsite->UserAccount->AccountId = $accountId;
print "<p>2: ";
print $delsite->UserAccount->AccountId;
// delete that site (line 352)
$result2 = $accountService->DeleteAccount(new SoapVar($delsite, SOAP_ENC_OBJECT));
I have also tried using the method by supplying the hardcoded string "sitetest1" for example, and the same error message above is generated.
Can you tell me how I should be using the DeleteAccount API method to process correctly?
This is the page of documentation:
http://download1.parallels.com/SiteBuilder/4.1.0/doc/api/ref_manual/en_US/html/4.1/index.html
where it says the syntax is:
public�ServiceDeleteResultOfAccountDeleteStatus[]�DeleteAccount(
���string[]�accountIds
);