Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

What's the difference between these APIs?

Discussion in 'cPanel Developers' started by akust0m, Oct 21, 2017.

  1. akust0m

    akust0m Well-Known Member

    Joined:
    Feb 19, 2016
    Messages:
    55
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    Melbourne
    cPanel Access Level:
    Root Administrator
    Hi there!

    I'm going to be making some bash scripts to perform some tasks, but I've noticed that there are a heap of different cPanel/WHM API's available:

    UAPI
    cPanel API 1
    cPanel API 2
    WHM API 0
    WHM API 1

    What's the difference between these? Are some becoming deprecated?

    Just trying to work out which ones to use.

    For example, part of my script needs to obtain all the document roots for an account for the primary domain and add-on domains. I came up with the following:

    uapi --user=$user DomainInfo domains_data | grep documentroot | awk '{print $2}'

    Does this look okay? I'm not an expert in bash or development at all, so be friendly :p

    Thanks!
     
  2. cPAusaf

    cPAusaf Linux Technical Analyst II
    Staff Member

    Joined:
    Aug 24, 2016
    Messages:
    23
    Likes Received:
    1
    Trophy Points:
    78
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hello,

    cPanel API 1 and WHM API 0 are both deprecated and should no longer be used. It is likely that cPanel API 2 will become deprecated in the near future, and our documentation states to use UAPI over it when possible.

    The UAPI command you are using looks to be correct and works fine when testing it out on my personal server.
     
Loading...

Share This Page