The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XML API: Adding & Removing Filters

Discussion in 'cPanel Developers' started by iSofia, Oct 12, 2014.

  1. iSofia

    iSofia Member

    Joined:
    Jun 3, 2014
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    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 'me@domain.com'",);			
    $xmlapi->api2_query($account, "Email", "deletefilter", $params);
    What have I done wrong? :confused:
     
  2. iSofia

    iSofia Member

    Joined:
    Jun 3, 2014
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    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. ;)
     
Loading...

Share This Page