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/WHM API Getting Started Help PHP

Discussion in 'cPanel Developers' started by MikeMartinOSM, Apr 8, 2016.

  1. MikeMartinOSM

    MikeMartinOSM Registered

    Joined:
    Apr 8, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    Hello! I'm looking to integrate some cpanel features in our in house CMS, specifically managing email forwarders and http redirects. Ideal usage to be within our own CMS (real time api)...idea is so our clients don't have to fuss with going into cpanel and recalling their login info just to do a email forwarder or something.

    I've been digging around in the documentation and I'm beyond confused on how to get started. It would appear I need the UAPI based on the functionality but I'm not sure how to use it and go about getting authenticated...and actually I'm starting to doubt if I even know what the UAPI is intended for? Maybe I need a different API?

    Could someone please give me some real world PHP examples on how to do this? I think I would need the "User and Password" option on that "Guide to API Authentication" but there appears to be no examples on how to authenticate that way AND use an API call? On each "Guide to ... API" it just specifically mentions only providing a security token but doesn't say how to generate one? Also with the "user and password" method, the example only shows for root access...what about calling some api functionality as a cpanel user?

    For example, if I had valid cpanel user and password, how would I go about say simply running the list email pop accounts function?

    Hopefully someone can help, as I've been spinning my wheels on this for hours!

    Many thanks!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    UAPI is the way to go for this type of script. The following thread offers some examples for PHP that you may find helpful:

    How to make new email accounts for cPanel user, from PHP script

    Thank you.
     
Loading...

Share This Page