XML API: Adding & Removing Filters

iSofia

Member
Jun 3, 2014
14
0
1
cPanel Access Level
Website Owner
When using the API1 function, addfilter, the newly created filter can be viewed with the API2 function, listfilters, but for some reason do not appear in cPanel itself. Furthermore, there seems no way to delete these filters, either with the API1 function delfilter or the API2 function deletefilter. This is how it is created:

Code:
$args = array($sEmail, "contains", "header_to", "Discard");			
$xmlapi->api1_query($account, "Email", "addfilter", $args);
And these were the attempts to remove it:

Code:
$args = array($sEmail, "Discard");			
$xmlapi->api1_query($account, "Email", "delfilter", $args);
Code:
$params = array('account'=>$sEmail, 'filtername'=>"$header_to contains '[email protected]'",);			
$xmlapi->api2_query($account, "Email", "deletefilter", $params);
What have I done wrong? :confused:
 

iSofia

Member
Jun 3, 2014
14
0
1
cPanel Access Level
Website Owner
The reason why it was not working is because the addfilter function adds old-style filters, which are not recognized by my host. I simply deleted the .filter file, and used the new storefilter function instead, which works well in conjunction with deletefilter.

Hope it may be of help to others. ;)