manual:api:reference:token:update

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

manual:api:reference:token:update [2021/01/27 21:18] (current)
Line 1: Line 1:
 +===== token.update =====
  
 +==== Description ====
 +
 +''​object token.update(object/​array **tokens**)''​
 +
 +This method allows to update existing tokens.
 +
 +<​note>​Only //Super admin// user type is allowed to manage tokens for other users.</​note>​
 +
 +==== 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 [[object|standard token properties]].
 +
 +==== Return values ====
 +
 +''​(object)''​ Returns an object containing the IDs of the updated tokens under the ''​tokenids''​ property.
 +
 +==== Examples ====
 +
 +=== Rename token ===
 +
 +Remove expiry date from token.
 +
 +Request:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​method":​ "​token.update",​
 +    "​params":​ {
 +        "​tokenid":​ "​2",​
 +        "​expires_at":​ "​0"​
 +    },
 +    "​auth":​ "​038e1d7b1735c6a5436ee9eae095879e",​
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +Response:
 +<code java>
 +{
 +    "​jsonrpc":​ "​2.0",​
 +    "​result":​ {
 +        "​tokenids":​ [
 +            "​2"​
 +        ]
 +    },
 +    "​id":​ 1
 +}
 +</​code>​
 +
 +==== Source ====
 +
 +CToken::​update() in //​ui/​include/​classes/​api/​services/​CToken.php//​.