XML-API: List all domains on a server along with their assigned IP

stards

Member
Jan 11, 2014
11
2
53
cPanel Access Level
Root Administrator
Hi

Is there a way to list all domains on a server along with their cpanel-assigned IP? I know there's "resolvedomainname?api.version=1&domain=example.com" but this one does a DNS resolve (not a straight out pull from the cpanel server itself like httpd.conf).

I'd hate to have to pull info out of vhosts from httpd.conf.

There's this perl module:

/usr/local/cpanel/Cpanel/UserDomainIp.pm

Is there way to leverage this piece of code reliably without it breaking in the future? If so what's the proper way to pull the info out?

Please help!

Thanks
 

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
San Francisco, CA
cPanel Access Level
Root Administrator
Hi

Is there a way to list all domains on a server along with their cpanel-assigned IP?
You'd think so but frustratingly, something so simple is not available. There's listaccts (List Accounts) which will show the primary domain and IP for each account but it does not provide sub/parked/addon domains.

The only place in the UI that shows all domains and their IPs is https://<hostname>:2087/cpsessXXXXXX/scripts/ipusage

You could parse this page for the information.

You could also write your own custom API module to gather this data: Writing cPanel Modules



I know there's "resolvedomainname?api.version=1&domain=example.com" but this one does a DNS resolve (not a straight out pull from the cpanel server itself like httpd.conf).

I'd hate to have to pull info out of vhosts from httpd.conf.

There's this perl module:

/usr/local/cpanel/Cpanel/UserDomainIp.pm

Is there way to leverage this piece of code reliably without it breaking in the future? If so what's the proper way to pull the info out?

Please help!

Thanks
You could write a custom API module that is a wrapper around UserDomainIP::getdomainip(). However, there's no guarantee that this function won't change in the future (though it hasn't in a long time).

Custom API module docs: Writing cPanel Modules
 

stards

Member
Jan 11, 2014
11
2
53
cPanel Access Level
Root Administrator
You could also write your own custom API module to gather this data: Writing cPanel Modules





You could write a custom API module that is a wrapper around UserDomainIP::getdomainip(). However, there's no guarantee that this function won't change in the future (though it hasn't in a long time).

Custom API module docs: Writing cPanel Modules

Thanks! At the very least now I have a sense of direction...