cpanel api to delete addon domains using curl

ehabehab Content Writer

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

  • ehabehab Content Writer

    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.

  • vyasvyas OGContent Writer

    I like doing it manually.

    In particular each and every dns record.

    Very gratifying

    VPS reviews | | MicroLXC | English is my nth language.

  • ehabehab Content Writer

    @vyas said:
    I like doing it manually.

    In particular each and every dns record.

    Very gratifying

    once in a while is fine, but if you have 10's scripting is the only way.

  • vyasvyas OGContent Writer

    @ehab said:

    @vyas said:
    I like doing it manually.

    In particular each and every dns record.

    Very gratifying

    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 | | MicroLXC | English is my nth language.

  • ehabehab Content Writer

    yes

  • vyasvyas OGContent Writer

    @ehab said:
    yes

    Looks like Jay. @seriesn

    Thanked by (1)ehab

    VPS reviews | | MicroLXC | English is my nth language.

  • ehabehab Content Writer

    @vyas said:

    i know your sensitive about hair.

    Thanked by (1)vyas
  • 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

    Thanked by (1)ehab

    https://quantumcore.com.au | Aussie VPS Host
    Pure NVMe Storage | 1GB Link | VPS Start at $5 AUD

  • ehabehab Content Writer
    edited May 2022

    @QuantumCore said:

    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 :persevere:

    https://quantumcore.com.au | Aussie VPS Host
    Pure NVMe Storage | 1GB Link | VPS Start at $5 AUD

  • ehabehab Content Writer

    @QuantumCore said:
    Where'd you find that? I had a look at the cPanel API doco and couldn't find that :persevere:

    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

Sign In or Register to comment.

This Site is currently in maintenance mode.
Please check back here later.

→ Site Settings