What's the difference between these APIs?

akust0m

Well-Known Member
Feb 19, 2016
70
4
8
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!
 

cPAusaf

Linux Technical Analyst III
Staff member
Aug 24, 2016
36
9
83
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.