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.

API2 and JSON

Discussion in 'cPanel Developers' started by mpuk, Apr 11, 2011.

  1. mpuk

    mpuk Registered

    Joined:
    Apr 11, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi All,

    I am looking at the cPanel API for use within a mobile app and I was just wondering if JSON can be used with the API2 functions?

    XML and JSON APIs

    I'm just a bit confused as the functions/examples listed on the link above doesn't include the API2 functions.
     
  2. 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
    Hi mpuk,

    Yes, you can. To make API2 calls remotely, you need to invoke them using the XML-API...I know, the name has "XML" but a JSON format is available from this binary API interface. You might want to read a recent blog article that introduces the various APIs here, Introduction to cPanel & WHM APIs - cPanel Integration.

    Anyway, here's an example URL to POST or GET against the XML-API binary, which returns a JSON formatted response. This particular call is for Email::listpopswithdisk against the cPanel user "dave" and his domain "daves.com".
    Code:
    URL: https://10.1.4.141:2083/json-api/cpanel?domain=daves.com&cpanel_jsonapi_user=dave&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=listpopswithdisk&cpanel_jsonapi_apiversion=2
    
    Let me know if you need more clarification.

    Regards,
    -DavidN
     
Loading...

Share This Page