Skip to main content

Accessing cPanel API2 functions via WHM API

Comments

5 comments

  • AndrewH.
    You should be able to access all cPanel API's via the 'cpanel' call with WHM API. That said, the user 'root' is probably not a cPanel user on your box. Try it out with one of the users with a valid cPanel account and let me know if you still have this problem.
    0
  • hlc
    Thanks for the reply Andrew - Using a normal cPanel account user login works, but that requires the password for that user. I need access to the cPanel functions for ALL accounts using a single login (ie, root access). ie, the same way I can login to WHM API and create accounts, etc. I need that functionality for the cPanel API.
    0
  • hlc
    Put another way, is it possible to access the Cpanel API via WHM using a non-cpanel username (eg, root, as I do with normal WHM API calls) to perform typical cPanel related actions (eg, creating an email, listing emails, etc)?
    0
  • AndrewH.
    Try the call exactly as you had it before, just swap cpanel_xmlapi_user=root to cpanel_xmlapi_user=someuser. You will still be authenticated as root but this just lets the API know to perform the action against that user. cPanel API's by design expect to know the username based on who makes the call, if you are calling it as root the API doesn't know what user to perform the action against. If you have any kind of password prompt you can also use the root or reseller password in place of the users but I don't think that should happen.
    0
  • hlc
    [RESOLVED] Re: Accessing cPanel API2 functions via WHM API
    ]Try the call exactly as you had it before, just swap cpanel_xmlapi_user=root to cpanel_xmlapi_user=someuser. You will still be authenticated as root but this just lets the API know to perform the action against that user. cPanel API's by design expect to know the username based on who makes the call, if you are calling it as root the API doesn't know what user to perform the action against. If you have any kind of password prompt you can also use the root or reseller password in place of the users but I don't think that should happen.

    Thanks for the assistance, that's working. In the authentication I need to use root:password (consistently), and cpanel_xmlapi_user=someuser (and no password specified).
    0

Please sign in to leave a comment.