xmlapi: could not find function "addautoresponder" in module email

barlow

Member
Mar 27, 2013
7
0
1
cPanel Access Level
Reseller Owner
Using xmlapi to manage email accounts has been going well until I started working with 'addautoresponder', which is coming back with the error "could not find function 'addautoresponder' in module 'email".

Is there something I should know? Is there some new function? Am I accessing API 1 incorrectly? I read somewhere that API 1 requires an ordered param array rather than a hashed param array, but that's from some years ago, right?

The code looks like this:

PHP:
$params = array('domain'=>$domain, 
			'email'=>$row['email'], 
			'from'=>$row['Full Name'], 
			'subject'=>$Subject,
			'body'=>$Body,
			'html'=>true,
			'interval'=>4,
			'start'=>$startTS,
			'stop'=>$endTS); 

$res = json_decode($xmlapi->api2_query($cpanelu, "Email", "addautoresponder", $params), true);
Any suggestions or guidance would be appreciated.

By the way, the people who developed xmlapi interface for CPANEL are heros!
 

barlow

Member
Mar 27, 2013
7
0
1
cPanel Access Level
Reseller Owner
OK, to answer my own question. Looking through xmlapi.php revealed that there are query functions for API1 and API2 - I hadn't noticed, duh. So the *working* code looks like this, with an ordered array as per the API documentation and 'api1_query' called:

PHP:
$params = array($username, 
		$row['Full Name'], 
		$Subject,
		$Body,
		$domain,
		true,
		"us-ascii",
		4,
		$startTS,
		$endTS); 
			
$res = json_decode($xmlapi->api1_query($cpanelu, "Email", "addautoresponder", $params), true);
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

I am happy to hear you were able to resolve the issue. Thank you for sharing the solution.