Child pages
  • WHM API 1 Functions - api_token_list
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Description

This function lists a WHM account's API tokens.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/api_token_list?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/api_token_list?api.version=1
 Command Line
whmapi1 api_token_list 


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "metadata" : {
      "command" : "api_token_list",
      "reason" : "OK",
      "result" : 1,
      "version" : 1
   },
   "data" : {
      "tokens" : {
         "subway" : {
            "acls" : {
               "upgrade-account" : 0,
               "create-acct" : 0,
               "edit-account" : 0,
               "limit-bandwidth" : 0,
               "suspend-acct" : 0,
               "list-accts" : 0,
            },
            "name" : "subway",
            "create_time" : 1500503835
			"last_used" : null
         }
      }
   }
}
 Output (XML)
<result>
	<metadata>
		<result>1</result>
		<command>api_token_list</command>
		<reason>OK</reason>
		<version>1</version>
	</metadata>
	<data>
		<tokens>
			<subway>
				<create_time>1483625276</create_time>
					<acls>
						<kill-acct>0</kill-acct>
						<list-acct>0</list-acct>
						<upgrade-acct>0</upgrade-acct>
						<create-acct>0</create-acct>
						<edit-acct>0</edit-acct>
						<limit-bandwidth>0</limit-bandwidth>
					</acls>
				<name>subway</name>
				<last_used>null</last_used>
			</subway>
		</tokens>
	</data>
</result> 


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
tokens hash

A hash of the WHM account's API token names.

Note:

$body

This hash contains the token-name return.

Note:

$body

 

token-name

hash

A hash of API token details.

Notes:

  • This return's name is the API token's name.
  • We added this return in cPanel & WHM version 68.
This hash contains the acls , name , create_time, and last_used returns. 

acls

hash

A hash of privileges available to the user.

The function returns this value in the token-name hash.

Note:

$body

This hash includes the acl-name return.

 

 

acl-name

Boolean

Whether the Access Control List (ACL) is enabled.

Note:

$body

The function returns this value in the acls hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

name

string

The API token's name.

The function returns this value in the token-name hash.

A valid API token name.subway

create_time

integer

The API token's creation time.

The function returns this value in the token-name hash.

A date in Unix time format.

1483625276

last_used

stringThe most recent time at which a user logged in to WHM or called an API function with this API token.This value always returns null.null
  • No labels