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

Description

This function updates an API token's settings.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/api_token_update?api.version=1&token_name=subway&new_name=job&acl-1=kill-acct&acl-2=list-acct
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/api_token_update?api.version=1&token_name=subway&new_name=job&acl-1=killacct&acl-2=list-acct
 Command Line
whmapi1 api_token_update token_name=subway new_name=job acl-1=kill-acct acl-2=list-acct


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.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "metadata" : {
      "result" : 1,
      "reason" : "OK",
      "command" : "api_token_update",
      "version" : 1
   },
   "data" : {
      "acls" : [
         "create-acct",
         "kill-acct"
      ],
      "create_time" : 1500664572,
      "name" : "job"
   }
}
 Output (XML)
<result>
<metadata>
	<reason>OK</reason>
	<result>1</result>
	<command>api_token_update</command>
	<version>1</version>
</metadata>
<data>
	<name>job</name>
	<create_time>1483625276</create_time>
	<acls>
		kill-acct
	    list-acct
	</acls>
</data>


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
token_name
string

Required

The API token's name.

A valid string.subway
new_namestring

The API token's new name.

Notes:

  • An API token name’s maximum length is 50 characters and the name may only contain alphanumeric characters, dashes ( - ), and underscores ( _ ).
  • You must assign a name that does not already exist to the API token.

If you do not use this parameter, the API token's name remains the same.

A valid string.job
acl-*string

The new privileges to assign to the token.

Note:

  • The function replaces all current privileges with the privileges that you pass in this parameter.
  • To assign multiple privileges to the token, increment the parameter name. For example: acl-1, acl-2acl-3.
  • You can only assign privileges that you possess to the API token.

If you do not use this parameter, the system will assign all of your privileges to the token.

A valid privilege that the user possesses.

 Click to view a list of ACL privileges...
  • acct-summary
  • add-pkg
  • add-pkg-ip
  • add-pkg-shell
  • allow-addoncreate
  • allow-emaillimits-pkgs
  • allow-parkedcreate
  • allow-unlimited-bw-pkgs
  • allow-unlimited-disk-pkgs
  • allow-shell
  • basic-system-info
  • basic-whm-functions
  • clustering
  • cors-proxy-get
  • cpanel-api
  • cpanel-integration
  • create-acct
  • create-dns
  • create-user-session
  • demo-setup
  • digest-auth
  • edit-account
  • edit-dns
  • edit-mx
  • edit-pkg
  • generate-email-config
  • limit-bandwidth
  • list-acct
  • list-pkgs
  • locale-edit
  • mailcheck
  • manage-api-tokens
  • manage-dns-records
  • manage-oidc
  • manage-styles
  • mysql-info
  • news
  • ns-config
  • park-dns
  • passwd
  • quota
  • rearrange-accts
  • resftp
  • restart
  • show-bandwidth
  • ssl
  • ssl-buy
  • ssl-gencert
  • ssl-info
  • track-email
  • thirdparty
  • upgrade-account
  • viewglobalpackages
  • all
kill-acct

Returns

ReturnTypeDescriptionPossible valuesExample
namestring

The API token's name.

Note:

Use this value to revoke an API token with WHM API 1's api_token_revoke function.

A valid token name. subway
create_timeintegerThe API token's creation time.

A date, in Unix time format.

1483625276
last_usedstring

The 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
aclsarray

An array of privileges assigned to the token.

 

An array of valid privileges.kill-acct
  • No labels