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.
      • 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.
      • startdate (date) — Date and time of plan creation. Format: YY MMM DD HH:MM
      • theme (string) — cPanel interface theme associated with the account.
      • user (string) — Username associated with the account. Format: username
    • 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>19M</diskused>
        <domain>example.com</domain>
        <email>user@example.net</email>
        <ip>127.0.0.1</ip>
        <owner>luvexample</owner>
        <partition>home</partition>
        <plan>Plan One</plan>
        <startdate>09 Apr 11 15:49</startdate>
        <suspended>0</suspended>
        <suspendreason>not suspended</suspendreason>
        <suspendtime/>
        <theme>x3</theme>
        <unix_startdate>1239482997</unix_startdate>
        <user>luvexample</user>
    </acct>
    <status>1</status>
    <statusmsg>Ok</statusmsg>
</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":[
      {
         "partition":"home",
         "startdate":"09 May 19 07:49",
         "plan":"level3 ",
         "suspended":0,
         "theme":"x3",
         "user":"gus",
         "unix_startdate":1242737345,
         "suspendreason":"not suspended",
         "suspendtime":null,
         "ip":"127.0.0.1",
         "domain":"example.com",
         "diskused":"0M",
         "owner":"gus",
         "email":"*unknown*",
         "disklimit":"unlimited"
      }
   ]
}
note Note: Typing ?searchtype=user&search=gus limits the results to accounts with a username containing gus.

Topic revision: r6 - 29 Sep 2009 - 17:13:42 - Main.MelanieSeibert
 

Copyright © cPanel 2000-2009.