Get all domains and subdomains
Hi all. Forgive me for my bad english.
I use a web provider that gave me a cpanel account a few years ago. Actually, I have multiple resellers accounts managed by me. I'd like to get all domains and subdomains on each of them.
I use the uapi using a token for the main account but I can't get informations from each of resellers accounts. I have to create a toekn on each account to get datas.
Is there a way to get all datas from the main access like the switch context on the UI ?
Thanks.
-
Hey there! What about this command? whmapi1 get_domain_info
This will return the following block of text for each domain on the server:docroot: /home/username/public_html domain: domain.com domain_type: main ipv4: 1.2.3.4 ipv4_ssl: 1.2.3.4 ipv6: ~ ipv6_is_dedicated: 0 modsecurity_enabled: 1 parent_domain: domain.com php_version: ea-php72 port: 80 port_ssl: 443 user: username user_owner: root
The user_owner field would tell you if this was owned by a certain reseller account. Let me know if that works!0 -
I'm not root on the server. I don't have this command available. I use the UAPI from my laptop. This is my code: echo "############################" echo "# List accounts" echo "############################" curl -qs -X POST -H "Authorization: cpanel $CPANEL_CREDENTIALS" "https://${URL}/execute/Resellers/list_accounts" | jq . echo echo "############################" echo "# List domains" echo "############################" curl -qs -X POST -H "Authorization: cpanel $CPANEL_CREDENTIALS" "https://${URL}/execute/DomainInfo/list_domains" | jq . echo echo "############################" echo "# Get usage" echo "############################" curl -qs -X POST -H "Authorization: cpanel $CPANEL_CREDENTIALS" "https://${URL}/execute/ResourceUsage/get_usages" | jq . echo echo "############################" echo "# List domains for ACCOUNT1" echo "############################" curl -qs -X POST -H "Authorization: cpanel $ACCOUNT1_CREDENTIALS" "https://${URL}/execute/DomainInfo/list_domains" | jq . echo echo "############################" echo "# List domains for ACCOUNT2" echo "############################" curl -qs -X POST -H "Authorization: cpanel $ACCOUNT2_CREDENTIALS" "https://${URL}/execute/DomainInfo/list_domains" | jq . ... ...
I'd like to access to all domains from the main account. I can change the context from the UI using a drop down menu. I don't know if I can do the same from the API.0 -
I don't believe there is an API tool that will provide that level of detail if you aren't the root user, unfortunately. 0
Please sign in to leave a comment.
Comments
3 comments