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.

api2_query using "delmx" with root account not working as expected.

Discussion in 'cPanel Developers' started by John D, Sep 10, 2014.

  1. John D

    John D Member

    Joined:
    Feb 10, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    We are trying to use the API2 "delmx" function to remove MX records from accounts.
    But we are getting the following error.

    "This feature requires the 'changemx' option and is not enabled on your account"​

    We are using the "root" account to instantiate the API2 call like so:

    Code:
    $apicall = new xmlapi('our.cpanel-server.com','root','pass');
    $apicall->api2_query('acpanelaccount','Email','delmx',array(
    		'domain' => 'thedomain.com',
    		'exchange' => 'mail.thedomain.com',
    		'preference' => '10'));
    
    It appears to me as though the "root" account is using the "Standard" feature list. When I enable "change mx" for this list it starts to work.

    We've assumed the "root" account would have unrestricted access.
    Is there anyway to change the feature list for the "root" account ?

    Thanks,
    John
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    To clarify, is the account you are removing the MX record from assigned the default feature list? Have you verified that it's not the feature list assigned to the account that's important, and not the "root" authentication?

    Thank you.
     
  3. John D

    John D Member

    Joined:
    Feb 10, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi cPanelMichael,

    Yes, the accounts we are trying to remove MX's from are all using packages with feature list "Standard" which has the "change mx" option unticked.

    After some testing it does appear that the feature list assigned to the account I am trying to remove the MX from needs this feature to do so. I would have thought it would have used the API2 authenticated user's feature list to restrict access for API calls.

    Is there any way to do this without giving our customers the ability to change mx.

    Thanks,
    John
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    There is no way around that restriction as far as I can tell. One possible workaround is to delete the MX record directly from the zone instead of using our API.

    Thank you.
     
Loading...

Share This Page