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.

WHM API to retrieve cPanel Theme list

Discussion in 'cPanel Developers' started by celerius, Oct 12, 2014.

  1. celerius

    celerius Registered

    Joined:
    Oct 3, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,

    Is there an API that'll allow me to retrieve a list of cPanel themes that a user can select in the system? I can do WHM API 0's modifyacct to modify the theme of the user but where can I get a list of the themes? If there isn't an API that will give me a list, are there any other APIs that has that data inside where I can parse and extract that information to form a list?

    I see that cPanel's API 2 has Branding::showpkgs but I'm unable to call the API with user=root and even when I switch the user to a non-root account I get a JSON response like this showing no themes.

    Code:
    https://example.com:2087/<token>/json-api/cpanel?user=john&cpanel_jsonapi_module=Branding&cpanel_jsonapi_func=showpkgs&cpanel_jsonapi_version=2
    
    {"cpanelresult":{"func":"showpkgs","data":[],"event":{"result":1},"apiversion":2,"module":"Branding"}}
    Thanks
     
  2. celerius

    celerius Registered

    Joined:
    Oct 3, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    i found that WHM API version 0's getlanglist actually has a list of themes in it but it's not showing the same list as the ones I see when I login to WHM/cPanel to create a new user. Is there an equivalent for API version 1 that actually works?
     
  3. cPAndrewHodge

    cPAndrewHodge cPanel UI Developer
    Staff Member

    Joined:
    Dec 10, 2012
    Messages:
    52
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    After a quick glance in WHM we are using functionality which is exposed via cPanel API2(Themes::get_available_themes). Unfortunately I can't seem to find any documentation but this call does not appear to have any parameters you pass to it, instead just call it and it should return the themes available to the user who you are authenticated with.
     
Loading...

Share This Page