Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

Terminate Reseller and Accounts — terminatereseller

This function will terminate a reseller's main account, as well as all accounts owned by the reseller.

Calling Functions

Using the XML API

To use the XML API to perform the terminatereseller function from within your custom script:

  • Append the /xml-api/terminatereseller function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/terminatereseller

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the terminatereseller function from within your custom script:

  • Append the /json-api/terminatereseller function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/terminatereseller

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

The terminatereseller function takes the following required variables as input:

  • reseller (string) — Name of the reseller to terminate.
  • terminatereseller (boolean) — Whether or not to terminate the reseller's main account.
    • 1 — yes.
    • 0 — no.
  • verify — Verification message. Enter the follwing, replacing $resellername with the name of the reseller: I%20understand%20this%20will%20irrevocably%20remove
    %20all%20the%20accounts%20owned%20by%20the%20reseller%20$resellername

note Note: Submit the entire request as a single string. For display purposes, the example above may be wrapped.

Output

Show Hide

  • terminatereseller — Root-level XML tag for the output of the terminatereseller function.
    • result — Results of the termination.
      • accts — Container for the account termination.
        • name — Name of the account being terminated.
        • rawout — Raw output of the account termination process.
        • status — Status of the operation.
          • 1 — success.
          • 0 — failure.
        • statusmsg — Information about the status of the function.

Examples

XML API

Show Hide

Calling /xml-api/terminatereseller?reseller=bob&terminatereseller=1&verify=I%20 understand%20this%20will%20irrevocably%20remove%20all%20the%20 accounts%20owned%20by%20the%20reseller%20bob will produce output similar to:

<terminatereseller>
   <result>
      <accts>
         <name>account1</name>
         <rawout> 
Collecting Domain Name and IP...User: account1 Domain: account1.tld ...
Done Killing all processes owned by user......Done Cleaning passwd,shadow,group
......Done Removing User from Group..........Done Removing Web Logs......Done 
Removing Crontab......Done Removing Virtual Hosts...Removed Extra Entries from 
httpd.conf ...Done Removing System User......Done Removing Group......Done 
Removing DNS Entries...account1.tld -> deleted from servername. ...Done 
Removing Email Setup...Removing /etc/valiases/account1.tld ...Done Removing 
mailman lists......Done Removing MySQL databases and users......Done Removing 
remotedomains,secondarymx,localdomains entries......Done Adding ip back to 
ipaddrpool...System has 0 free ips. ...Done Removing user's cPanel Databases & 
Updating......Done Reloading Services......DoneSending Contacts......Done Updating 
internal databases...Updating ftp passwords for all users Ftp password files updated. 
Ftp vhost passwords synced ...Done Running post removal 
scripts......Done <br /><b>Account Removal Complete!!!</b><br /> 
</rawout>
          <status>1</status>
          <statusmsg>account1 account removed</statusmsg>
       </accts>
       <accts>
          <name>bob</name>
          <rawout> 
Collecting Domain Name and IP...User: bob Domain: bob.tld ...Done Killing all processes 
owned by user......Done Cleaning passwd,shadow,group......Done Removing User from 
Group..........Done Removing Web Logs......Done Removing Crontab......Done Removing 
Virtual Hosts...Removed Extra Entries from httpd.conf ...Done Removing System 
User......Done Removing Group......Done Removing DNS Entries......bob.tld -> deleted from 
servername. ...Done Unable to unlink /var/named/bob.tld.db, file does not exist.bob.tld -> 
deleted from servername. ...Done Removing Email Setup...Removing /etc/valiases/bob.tld 
...Done Removing mailman lists......Done Removing MySQL databases and users...Database 
``bob_db1'' dropped Database ``bob'' dropped ...Done Removing 
remotedomains,secondarymx,localdomains entries......Done Adding ip back to 
ipaddrpool...System has 0 free ips. ...Done Removing user's cPanel Databases & 
Updating......Done Reloading Services......Done
Sending Contacts......Done Updating internal databases...Updating ftp passwords for 
all users Ftp password files updated. Ftp vhost passwords synced ...Done Running 
post removal scripts......Done <br /><b>Account Removal Complete!!!</b><br /> 
</rawout>
          <status>1</status>
          <statusmsg>bob account removed</statusmsg>
       </accts>
       <privdelete>1</privdelete>
       <status>1</status>
       <statusmsg>Account Terminations Complete</statusmsg>
   </result>
</terminatereseller>

note Note: Submit the entire request as a single string. For display purposes, the example above may be wrapped.

JSON API

Show Hide

Calling /json-api/terminatereseller?reseller=bob&terminatereseller=1&verify=I%20 understand%20this%20will%20irrevocably%20remove%20all%20the%20 accounts%20owned%20by%20the%20reseller%20bob will produce output similar to:

{
   "result":[
      {
         "status":1,
         "privdelete":1,
         "statusmsg":"Account Terminations Complete",
         "accts":{
            "paige":{
               "status":1,
               "statusmsg":"bob account removed",
               "rawout":"Running pre removal script (/scripts/prekillacct)......
DoneCollecting Domain Name and IP...User: bob\nDomain: example.com\n...
DoneKilling all processes owned by user......DoneCleaning passwd,shadow,
group......DoneRemoving User from Group..........
DoneRemoving Web Logs......DoneRemoving Bandwidth Files......
DoneRemoving Crontab......DoneRemoving Virtual Hosts...Removed 
Extra Entries from httpd.conf\nexample.com not found in httpd.conf.\n...
DoneRemoving MySQL databases and users......DoneRemoving 
PostgreSQL databases and users......DoneRemoving System User......
DoneRemoving Group......DoneRemoving DNS Entries...example.com 
=> deleted from server. \n...DoneRemoving Email Setup...Removing 
/etc/valiases/example.com\n...DoneRemoving mailman lists......
DoneRemoving remotedomains,secondarymx,localdomains entries......
DoneRemoving Counter Data......DoneAdding ip back to the ip address pool...
System has 2 free ips.\n...DoneRemoving user's cPanel Databases & 
Updating......DoneReloading Services......DoneRemoving mail and service 
configs...\n...DoneSending Contacts......DoneUpdating internal databases...
Updating ftp passwords for bob\nPurging ftp user paige\nFtp password files 
updated.\nFtp vhost passwords synced\n...DoneRunning post removal scripts 
(/scripts/legacypostkillacct, /scripts/postkillacct)......DoneAccount Removal 
Complete!!!...bob account removed...Done"
            }
         }
      }
   ]
}

note Note: Submit the entire request as a single string. For display purposes, the example above may be wrapped.

Topic revision: r6 - 29 Sep 2009 - 18:05:52 - MelanieSeibert