cpanel api to delete addon domains using curl
hi
does anyone know how to use cpanel api to delete addon domains.
preferably using curl or a php script.
i don't mind making several calls just delete the domain
Thanks for any helps
Tagged:
Comments
It would be best if you tried that. It's should be working;
https://api.docs.cpanel.net/openapi/whm/operation/delete_domain/?_ga=2.60178669.1144815184.1652836475-1008392594.1628034175
I tried the above with several combinations but didn't work either with access denied, function does not exists etc ...what i would like is a complete example if need
curl authenticate + getsession "if needed"
curl call the delete api
but cpanel api's are fragmented between old-new not complete for example the above will not delete the subdomains you'd wish there is a parameter recursive.
I think a lot of improvements can be made and should discourage old calls.
I like doing it manually.
In particular each and every dns record.
Very gratifying
VPS reviews and benchmarks |
once in a while is fine, but if you have 10's scripting is the only way.
You have low threshold for pain ??
VPS reviews and benchmarks |
yes
Looks like Jay. @seriesn
VPS reviews and benchmarks |
i know your sensitive about hair.
I'm fairly certain that you can only delete domains via the WHM API.
If you have WHM API access then you could run the following CURL -
curl -H'Authorization: whm username:MYAPITOKEN' https://hostname.example.com:2087/json-api/delete_domain?api.version=1&domain=example.com
https://quantumcore.com.au | Aussie VPS Host
Pure NVMe Storage | 1GB Link | VPS Start at $5 AUD
I haven't tried if i can access with a whm account, infact not sure if my normal cpanel user account can access that way.
anyway i found something working for now
curl --location --request GET 'https://hostname.example.com:2083/json-api/cpanel?cpanel_jsonapi_version=2&domain=example.com&cpanel_jsonapi_module=AddonDomain&cpanel_jsonapi_func=deladdondomain&subdomain=example.com.maindomain.com' \ --header 'Authorization: cpanel YOURCPID:YOURTOKEN'
Where'd you find that? I had a look at the cPanel API doco and couldn't find that
https://quantumcore.com.au | Aussie VPS Host
Pure NVMe Storage | 1GB Link | VPS Start at $5 AUD
yeah, the API and docs need a lot of improvements. I can sometimes say this is shit.
I am thinking to publish a postman collection for both cpanel and directadmin basic 101 calls... just need to find the time.
Yeah, you'd get a bit of traffic for that I'd guess since I searched for API stuff and apart from the cPanel doco, I didn't get a lot of results, even from the cPanel forums.
https://quantumcore.com.au | Aussie VPS Host
Pure NVMe Storage | 1GB Link | VPS Start at $5 AUD
some gist sample "not mine"
https://gist.github.com/xxdannilinxx/36f5acb54da65701658f35a952baa530