Skip to main content

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

Comments

4 comments

  • KostonConsulting
    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://:2083//json-api/cpanel?cpanel_jsonapi_version=2&cpanel_jsonapi_module=DomainLookup&cpanel_jsonapi_func=listdocroots To see if you have WHM access: https://:2087//json-api/listaccts Please note that you will need to fill in your normal cPanel/WHM URL for and you will need to log in to cPanel/WHM and copy the part of the URL that looks like /cpsessXXXXXXXX/ to
    0
  • cPanelMichael
    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.
    0
  • Patanjali
    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: [quote="KostonConsulting, post: 1630561">https://:2083//json-api/cpanel?cpanel_jsonapi_version=2&cpanel_jsonapi_module=DomainLookup&cpanel_jsonapi_func=listdocroots
    I get: [QUOTE]{"cpanelresult":{"apiversion":2,"func":"listdocroots","error":"Could not find function 'listdocroots' in module 'DomainLookup'","data":{"result":0,"reason":"Could not find function 'listdocroots' in module 'DomainLookup'"},"module":"DomainLookup"}}
    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?
    0
  • Patanjali
    Using the class at: [url=http://forums.glowhost.com/programming-talk/using-cpanel-api-creating-email-account-forwarders-your-own-php-scripts-2798.html]Using cPanel API for creating email account and forwarders in your own PHP scripts, I was able to access the APIs via XMLAPI, and create a Forward, so access is not barred for me. Now I just need to work out how to call the APIs directly. When I do that I will come back and document a simple test, so anyone following will not have to trip over the same 'stone'.
    0

Please sign in to leave a comment.