API2 - Parking Domain Problem

eddit

Registered
Jul 5, 2010
2
0
51
I got adding & removing email addresses worked out this morning using xmlapi.php so pressed on to parking domains with the api and now can't figure out this error.


xmlapi-Array
(
[cpanelresult] => Array
(
[error] => Error from park wrapper: The following domain is not configured for this account: example.com.example.com: @Cpanel:: DOMAINS=(example.com, demo1.example.com, demo2.example.com)
[data] => Array
(
[0] => Array
(
[result] => 0
[reason] => Error from park wrapper: The following domain is not configured for this account: example.com.example.com: @Cpanel:: DOMAINS=(example.com, demo1.example.com, demo2.example.com) )
)

[event] => Array
(
[result] => 1
)

[module] => Park
[apiversion] => 2
[func] => park
)
)


And the code

Code:
include "xmlapi.php";

$ip = "1.2.3.4";
$account = "cpanelac";
$account_pass = "letmein";
$top = "example.com";
$domain = "parkeddomain.co.uk";	
				
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($account, $account_pass);
				
$result = $xmlapi->api2_query($account, "Park", "park", array(domain=>$domain,topdomain=>$top) );				
				
$json = json_decode($result, true);
(and get the array above)
I set the default to json instead of xml & port to 2083 in xmlapi.php
Tried the $xmlapi->park() funtion too.
Also changed my quote of parked domains from unlimited to 10000 just in case.
Run out of ideas for making it work & no Google searches threw anything up.

Edit: Forgot to mention I can add/remove parked domains through cPanel no problem.
 
Last edited:

eddit

Registered
Jul 5, 2010
2
0
51
Fixed it. Some caffeine and an afternoon nap sorted it out :)

Basically the API2 documents are wrong - I tried the API1 docs and for API1 the topdomain var is for optionally adding subdomains, so trying API2 with just the domain I want to park = success.

Code:
$domain = "parkeddomain.co.uk";	
$result = $xmlapi->api2_query($account, "Park", "park", array(domain=>$domain));
The domain on which is parked is taken from $account - your cpanel account.