token.generate
Description
object token.generate(array tokenids)
This method allows to generate tokens.
Only Super admin user type is allowed to manage tokens for other users.
Parameters
(array)
IDs of the tokens to generate.
Return values
(array)
Returns an array of objects containing the ID of the generated token under the tokenid
property and generated authorization string under token
property.
Property | Type | Description |
---|---|---|
tokenid | string | ID of the token. |
token | string | The generated authorization string for this token. |
Examples
Generate multiple tokens
Generate two tokens.
Request:
{
"jsonrpc": "2.0",
"method": "token.generate",
"params": [
"1",
"2"
],
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"tokenid": "1",
"token": "bbcfce79a2d95037502f7e9a534906d3466c9a1484beb6ea0f4e7be28e8b8ce2"
},
{
"tokenid": "2",
"token": "fa1258a83d518eabd87698a96bd7f07e5a6ae8aeb8463cae33d50b91dd21bd6d"
}
],
"id": 0
}
Source
CToken::generate() in ui/include/classes/api/services/CToken.php.