• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Sitebuilder API integration

A

ayazici

Guest
Hello,

I'm trying to write a phpscript to create sitebuilder accounts outside of sitebuilder.

As mentioned below link, http://download1.swsoft.com/Sitebuilder/4.0.0/doc/admin/en_US/sitebuilder-4.0-dev-guide/45400.htm

I've just copied and past example code and changed URL, Username, Password values..

But got an error like

"Fatal error: Uncaught SoapFault exception: [ERROR_GENERIC] Generic error. in /var/www/html/sitebuilder/sb.php:111 Stack trace: #0 [internal function]: SoapClient->__call('CreateAccount', Array) #1 /var/www/html/sitebuilder/sb.php(111): Utils_SoapClient->CreateAccount(Object(SoapVar)) #2 {main} thrown in /var/www/html/sitebuilder/sb.php on line 111"

How can i fix this?

My php version is 5.2.3 compiled with --enable-soap option.

Thanks
 
apparently there are several errors in the example:
1) myEmail is not a valid email address
2) myRole is not a valid Role (it should be either Siteowner of Reseller)
3)There is no planId parameter which is required. You can either create a new plan with the CreatePlan call or use a deprecated CreateAccountWithNewPlan method.

BTW, API documentation is always available locally on http://localhost/ServiceFacade/4.0
 
Hello,

I've corrected email address and created a plan thru sitebuilder interface.

my parameters like

$struct = new stdClass();

$struct->username = 'myuser';
$struct->password = 'mypassword';
$struct->firstName = 'George W';
$struct->lastName = 'Bush';
$struct->email = '[email protected]';
$struct->role = 'Siteowner';
$struct->planId = 'Deneme';


and it says


Fatal error: Uncaught SoapFault exception: [ERROR_ACTION_FAILED] Action has been failed. in /var/www/html/sitebuilder/sb.php:108 Stack trace: #0 [internal function]: SoapClient->__call('CreateAccount', Array) #1 /var/www/html/sitebuilder/sb.php(108): Utils_SoapClient->CreateAccount(Object(SoapVar)) #2 {main} thrown in /var/www/html/sitebuilder/sb.php on line 108

Thank you
 
planId should be plan identifier, not plan name. Normally you should set the value of planId from previous call to CreatePlan, FindPlans or GetAvailablePlans.
For testing purposes you can get planId from plan list. Goto /Admin/Plan/List and hover mouse cursor over any list item, you should see URL like http://.../Admin/Plan/Edit?planId=6 in the status bar. 6 is the planId.
 
link shows me that planId for "Deneme" is 2. I've tried it but errror is same :(
 
Hmm, works for me.

PHP:
$struct = new stdClass();
$struct->username = 'myUserName3';
$struct->password = 'myPassword';
$struct->firstName = 'myFirstName';
$struct->lastName = 'myLastName';
$struct->email = '[email protected]';
$struct->role = 'Reseller';
$struct->planId = 2;

try {
    $result = $accountService->CreateAccount(new SoapVar($struct, SOAP_ENC_OBJECT));
}
catch (SoapFault $fault) {
    var_dump($fault);
}
This code will provide some details on why it failed.
 
First of all, thank you very much for your reply. I can create a reseller now but when i try to create "Site Owner" it says

["faultstring"]=>
string(23) "Action has been failed."
["faultcode"]=>
string(19) "ERROR_ACTION_FAILED"
["faultactor"]=>
string(5) "admin"
["detail"]=>
string(43) "User role should be Site owner or Reseller."


What am i missing again?

Thanks
 
Back
Top