token.update

Description

object token.update(object/array tokens)

This method allows to update existing tokens.

The Manage API tokens permission is required for the user role to manage tokens for other users.

Parameters

(object/array) Token properties to be updated.

The tokenid property must be defined for each token, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.

The method accepts tokens with the standard token properties.

Return values

(object) Returns an object containing the IDs of the updated tokens under the tokenids property.

Examples

Remove token expiry

Remove expiry date from token.

Request:

{
           "jsonrpc": "2.0",
           "method": "token.update",
           "params": {
               "tokenid": "2",
               "expires_at": "0"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "tokenids": [
                   "2"
               ]
           },
           "id": 1
       }

Source

CToken::update() in ui/include/classes/api/services/CToken.php.