object token.generate(array tokenids)
This method allows to generate tokens.
The Manage API tokens permission is required for the user role to manage tokens for other users.
A token can be generated by this method only if it has been created.
(array)
IDs of the tokens to generate.
(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. |
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
}
CToken::generate() in ui/include/classes/api/services/CToken.php.