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.

Simple way to determine if I can access the cPanel APIs?

Discussion in 'cPanel Developers' started by Patanjali, Apr 26, 2014.

  1. Patanjali

    Patanjali Member

    Joined:
    Apr 26, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I am a website owner with a retail account (not reseller).

    I would like to know if I can access the cPanel APIs, particularly the Forwarder functions.

    Is there a simple way to determine if I can access them?

    I am not familiar with the intricacies of cPanel under the hood, so please don't assume I know all the technicals.


    If it helps, I uploaded the PublicAPI files to my server, and ran the 'Using_the_LivePHP_Service.php' script, resulting in:

    which would seem to indicate that it couldn't contact the PHP engine.


    Any help would be appreciated. Thanks.
     
  2. 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
    If you have cPanel access, you have access to API1 and API2. If you have WHM access, you have access to the general XML/JSON API. You can test these with a URL.

    To see if you have cPanel api access:

    https://<your_server_name>:2083/<cpsess_name>/json-api/cpanel?cpanel_jsonapi_version=2&cpanel_jsonapi_module=DomainLookup&cpanel_jsonapi_func=listdocroots

    To see if you have WHM access:

    https://<your_server_name>:2087/<cpsess_name>/json-api/listaccts

    Please note that you will need to fill in your normal cPanel/WHM URL for <your_server_name> and you will need to log in to cPanel/WHM and copy the part of the URL that looks like /cpsessXXXXXXXX/ to <cpses_name>
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

    Some hosting providers allow their cPanel users access to the "API Shell" feature documented here:

    cPanel - API Shell

    This can help you to formulate API function calls and provides a quick way of determining which functions are available to you. However, this feature is often not enabled by default, so the previous post is typically the best way of checking to see if an API function succeeds.

    Thank you.
     
  4. Patanjali

    Patanjali Member

    Joined:
    Apr 26, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thanks for the replies. Sorry I didn't get back earlier, but I had forgotten to subscribe to this thread, so I didn't know you had actually been very diligent!

    To this:
    I get:
    What does that mean as far as API access goes? Does it mean I have some access, or am I just getting my hopes up?
     
  5. Patanjali

    Patanjali Member

    Joined:
    Apr 26, 2014
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner

Share This Page