Page tree
Skip to end of metadata
Go to start of metadata

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:

  • 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. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{  
   "metadata":{  
      "result":1,
      "command":"api_token_list",
      "reason":"OK",
      "version":1
   },
   "data":{  
      "tokens":[  
         {  
            "name":"subway",
            "last_used":149473687,
            "create_time":1483625276
         }
      ]
   }
}
 Output (XML)
<result>
	<metadata>
		<result>1</result>
		<command>api_token_list</command>
		<reason>OK</reason>
		<version>1</version>
	</metadata>
	<data>
		<tokens>
			<create_time>1483625276</create_time>
			<name>subway</name>
			<last_used>1498473687</last_used>
		</tokens>
	</data>
</result> 

Note:

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

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
tokensarray of hashesAn array of hashes that contains details about WHM account's API tokens.

Each hash contains the create_time, name, and last_used returns.

 

create_time

integerThe API token's creation time.

A date in Unix time format.

1483625276
 

name

string

The API token's name.

A valid API token name.subway

 

 

  • No labels