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.

cPanel client API without root level WHM

Discussion in 'cPanel Developers' started by miles100, Apr 5, 2012.

  1. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi There,

    I have some tricky questions about integrating the API before going through the documentation.

    I want to allow some of my clients to add, edit or create email accounts found in their cpanel login from another private groupware server located out side the whm server. I don't have root access to my whm server but I do have reseller whm access.

    Question is, In order to customize the API for remote cpanel email management by each cpanel administrator, do I have to have root whm access to get the API configured?

    Is it possible to start coding the cpanel API on the third party server for email management without full root whm access ?

    In other words I have a web based groupware software running on another server and I want each client to administer their email domain from the groupware interface without logging into their cpanel account. Well they will have to put the user name and password inside the groupware interface only once and the database of the groupware server will store cpanel user name and the password of their remote cpanel account. In otherwords the groupware server will become the whm interface. I want to make sure that I don't need root whm access to interface between the groupware server and the cpanel server. I want the client to manage their email accounts and users inside the groupware interface.

    Thanks
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Adding icons into cPanel (e.g. to replace ones you remove) or editing their behavior requires root access, unfortunately. This doesn't deal with the API, this deals with the plugin system - which requires root access. The APIs do not.
     
  3. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I guess my question is some what different from your answer or I may have misunderstood your answer . I will not be adding any icons to cpanel.

    Here is an Example of what I intend to do:
    *I have a cpanel user setup on server-A via reseller WHM. This cpanel user only wants to use cpanel to add new emails or manage email accounts, change email quota,configure spam etc but not by directly logging in to his/her cpanel profile.

    *Now this user wants to login to his/her cpanel account from a web interface installed on another server to manage emails etc on Server A, will call this other server-B. Client only gets access to a web page on server-b.Nothing else.
    This server-B might not necessarily have cpanel but a secure webpage. But client should be able to access his/her cpanel profile found on server A via server -b's web interface to manage email addresses . how can I achieve this using the API. If you ask me why I need the client to use a webpage found on Server-b to login to the cpanel account, since server B will have so many other company specific web apps running on that server-b's web page. If any icons are installed, it will be on server b's web page to correspond to cpanel commands to manage email accounts etc. In other words client will not know about server-A. Client thinks he/she only logs into server-b to manage email addresses etc. Hope this is clear enough. thanks
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Well that certainly changes things :). Thanks.

    In this scenario, the APIs would be the way to go and as a reseller you can certainly use the APIs. Since you are effectively building all your own interfaces for managing email etc, you may find it easiest to start with the XML-API PHP class and use that to call functions via the XML-API (which you, as a reseller, can use to do things you can do as a reseller) to trigger things in API1 and API2 (the APIs of the cPanel interface).

    There is no pre-designed kit for managing email remotely, so you will be building much of this from scratch but our XML-API PHP class will give you a good jump start on things. You can download that from cPanel & WHM's SDK - and there you can also discover the various API1 and API2 functions that are related to email. The PHP Class also includes a function to let you easily call API1 and API2 functions over the XML-API.
     
  5. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks and well said. This is what I want to confirm. Cheers
     
  6. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Also one Last important question as many might find it useful? I'm planning on running a project on building an outlook 2007,2010 plugin and a Thunderbird plug-in to filter spam at cpanel server level without having to login to cpanel or web-mail. Even for this what's required is the API, I assume the following API values may help or is there anything else that I will have to consider for outlook plugins due to complexities? Baiscally what I expect is fast server/account level spam filter rules created from Outlook by right clicking the emails or by selecting all, the emails found inside the junkmail folder in outlook. When the outlook user right click a spam email to filter block spam from the email server in the future, without receiving it to the outlook Inbox, the outlook user gets the option from the right click drop down to filer by subject or email address. Most spams can be blocked by subject I guess. Do you think this might be possible with the API?

    Email::addfilter

    API Version: 1 - Click here for documentation
    Syntax: Email::addfilter( match value, method, msgpart, dest )
    Description: Add an account-wide email filter.
    Parameters:
    match value (string)
    The text or value for which to check.
    method (string)
    The type of matching to use. The following values are accepted for numeric operations: is above, is not above, is below, is not below, equals. The following values are accepted for string operations: contains or begins.
    msgpart (string)
    The section of the email to check. Valid values include header_from, header_subject, header_to, reply_address, message_body, message_headers, h_to, h_cc, h_bcc, not delivered, error_message, h_X-Spam-Status, h_X-Spam-Score, and h_X-Spam-Bar.
    dest (string)
    The destination for filtered email. This value can be another email address, Discard, or a pipe to a shell application.
    Returns:

    This function does not produce any output.
     
  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This creates email filters that impact all email accounts under a cPanel account (not individual email accounts). This means any employee in a company can set up filters such that their CEO never gets any email, if you do this. Given the security/privacy implications here, I would advise against this particular implementation. However, I am unaware of a way to use the APIs to create an email filter that only impact a single email account.
     
  8. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    To create a filter for a specific email account (user level email filter), make sure to use the account parameter on the Email::storefilter() api2 call:


    Email Module Documentation
     
  9. miles100

    miles100 Member

    Joined:
    Apr 1, 2012
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thanks fellas. Bit of work and complexities to get it working on outlook, but it's possible with a bit of filter limitations. cheers
     
  10. SAbboushi

    SAbboushi Registered

    Joined:
    Oct 25, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Just wanted to get a clarification on:
    >> you may find it easiest to start with the XML-API PHP class and use that to call functions via the XML-API (which you, as a reseller, can use to do things you can do as a reseller) to trigger things in API1 and API2 (the APIs of the cPanel interface).<<

    Can any user write code using API1 and API2 as long as they have a cpanel username and password? Or is at least reseller level required? Can users be blocked from using API1 and API2?
     
  11. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    anyone with cPanel credentials can use API1 and API2 to affect their account. In fact, the cPanel default theme (x3) is build on top of API1 and API2. If the user is permitted to perform a given action in the cPanel interface, they can use the same underlying API1 or API2 call; there is no practical way to block a user from making these calls.

    Additionally, a reseller may perform API1 and API2 call on behalf of users they own. Again, this is the same as if the reseller where to log into the cPanel interface and select the user from the drop down at the top of the page.
     
Loading...

Share This Page