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



integrationblogcta.jpg

List Accounts — listaccts

This function lists all accounts on the server, and also allows you to search for a specific account or set of accounts.

Calling Functions

Using the XML API

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

  • Append the /xml-api/listaccts 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/listaccts

  • 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 listaccts function from within your custom script:

  • Append the /json-api/listaccts 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/listaccts

  • 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 listaccts function takes the following variables as input. Both variables are optional:

  • searchtype — Type of account search. Allowed values: domain, owner, user, ip, package
  • search — Search criteria; this field takes regular expressions.

Output

Show Hide

  • listaccts — Root-level XML tag for the output of the listaccts function.
    • acct — Container for the account information.
      • disklimit (string) — Disk space usage limit for the account, in Megabytes. Example: 500M
      • diskused (string) — Current disk space usage for the account, in Megabytes. Example: 500M
      • domain (string) — Name of the root domain for the account. Example: example.com
      • email (string) — Contact email address for the account. Example: user@example.com
      • ip (string) — IP address of root domain on the account.
      • maxaddons (integer or string) — The maximum number of addon domains available to the account.
      • maxftp (integer or string) — The maximum number of FTP accounts available to the account.
      • maxlst (string) — The maximum number of mailing lists available to the account.
      • maxparked (integer or string) — The maximum number of parked domains available to the account.
      • maxpop (integer or string) — The maximum number of email accounts available to the account.
      • maxsql (integer or string) — The maximum number of databases available to the account.
      • maxsub (integer or string) — The maximum number of subdomains available to the account.
      • owner (string) — Reseller or root owner of the account. Example: username
      • partition (string) — The disk/partition on which the user's home directory is located.
      • plan (string) — Hosting package associated with the account.
      • shell (string) — The path to the shell, if the cPanel account has shell access. (e.g. /bin/bash)
      • startdate (date) — Date and time of plan creation. Format: YY MMM DD HH:MM
      • suspended (boolean) — A boolean value that indicates whether or not the account is currently suspended. 1 indicates that the account is suspended, while 0 indicates that the account is not suspended.
      • suspendreason (string) — The reason for the account's suspension, if one was given.
      • suspendtime (integer) — The time of the account's suspension in Unix epochal time. This XML node will appear undefined if the account is not suspended.
      • theme (string) — cPanel interface theme associated with the account.
      • unix_startdate (integer) — The date the account was created in Unix epochal time.
      • user (string) — Username associated with the account. Format: username
      • MAX_EMAIL_PER_HOUR (integer) — The maximum number of emails the account can send in an hour. This parameter's default value is unlimited. This parameter is only available in version 11.32+.
      • MAX_DEFER_FAIL_PERCENTAGE (integer) — The percentage of failed or deferred email messages the account can send per hour before outgoing mail is rate-limited. The system only applies this value after the MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION value is met. This parameter's default value is unlimited. This parameter is only available in version 11.32+.
      • MIN_DEFER_FAIL_TO_TRIGGER_PROTECTION (integer) — The minimum number of failed or deferred email messages the account can send before outgoing mail is subject to rate-limiting (according to the percentage set by the MAX_DEFER_FAIL_PERCENTAGE value). This parameter's default value is unlimited. This parameter is only available in version 11.32+.
    • status (boolean) — Whether or not the account listing function completed successfully.
      • 1 — yes.
      • 0 — no.
    • statusmsg (string) — Details about the status of the function.

Examples

XML API

Calling this function from WebHost Manager:

https://example.com:2087/xml-api/listaccts?searchtype=user&search=luv

will produce output similar to the following:

<listaccts>
    <acct>
        <disklimit>unlimited</disklimit>
        <diskused>57884M</diskused>
        <domain>example.com</domain>
        <email>user@example.com</email>
        <ip>192.168.0.1</ip>
        <maxaddons>10</maxaddons>
        <maxftp>unlimited</maxftp>
        <maxlst>unlimited</maxlst>
        <maxparked>unlimited</maxparked>
        <maxpop>unlimited</maxpop>
        <maxsql>unlimited</maxsql>
        <maxsub>unlimited</maxsub>
        <owner>root</owner>
        <partition>home</partition>
        <plan>default</plan>
        <shell>/bin/bash</shell>
        <startdate>09 Aug 13 15:01</startdate>
        <suspended>0</suspended>
        <suspendreason>not suspended</suspendreason>
        <suspendtime/>
        <theme>x3</theme>
        <unix_startdate>1250193678</unix_startdate>
        <user>user</user>
    </acct>
</listaccts>

note Note: Typing ?searchtype=user&search=luv limits the results to accounts with a username containing luv.

JSON API

Calling this function from WebHost Manager:

https://example.com:2087/json-api/listaccts?searchtype=user&search=luv

will produce output similar to the following:

{
   "status":1,
   "statusmsg":"Ok",
   "acct":[
      {
         "startdate":"09 Aug 13 15:01",
         "plan":"default",
         "suspended":0,
         "theme":"x3",
         "shell":"/bin/bash",
         "maxpop":"unlimited",
         "maxlst":"unlimited",
         "maxaddons":"10",
         "suspendtime":null,
         "ip":"192.168.0.1",
         "maxsub":"unlimited",
         "domain":"example.com",
         "maxsql":"unlimited",
         "partition":"home",
         "maxftp":"unlimited",
         "user":"user",
         "suspendreason":"not suspended",
         "unix_startdate":1250193678,
         "diskused":"57884M",
         "maxparked":"unlimited",
         "email":"user@example.com",
         "disklimit":"unlimited",
         "owner":"root"
      }
   ]
}
note Note: Typing ?searchtype=user&search=gus limits the results to accounts with a username containing gus.

Topic revision: r10 - 15 Feb 2012 - 19:57:59 - Main.MelanieSeibert
 

Copyright © cPanel 2000–2011.