[comment]: # translation:outdated

[comment]: # ({4480ea6d-4480ea6d})
# token.generate

[comment]: # ({/4480ea6d-4480ea6d})

[comment]: # ({3f13b874-3f13b874})
### 説明

`object token.generate(array tokenids)`

このメソッドではトークンを生成できます。

::: noteclassic
他のユーザーのトークンを管理できるのは*Super admin*ユーザータイプのみです。
:::

[comment]: # ({/3f13b874-3f13b874})

[comment]: # ({db2ee95a-db2ee95a})
### パラメータ

`(array)` 生成するトークンのID

[comment]: # ({/db2ee95a-db2ee95a})

[comment]: # ({79084a4e-101a0040})
### 戻り値

`(array)` `tokenid`プロパティで生成されたトークンのIDと`token`プロパティで生成された認証文字列を含むオブジェクトの配列を返します。

|プロパティ|[タイプ](/manual/api/reference_commentary#data_types)|説明|
|--|--|------|
|tokenid|string|トークンID|
|token|string|このトークンに対して生成された認証文字列|

[comment]: # ({/79084a4e-101a0040})

[comment]: # ({b41637d2-b41637d2})
### 例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({14225527-c0623539})
#### 複数のトークンを生成

２個のトークンを生成します

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "token.generate",
    "params": [
        "1",
        "2"
    ],
    "auth": "3a57200802b24cda67c4e4010b50c065",
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "tokenid": "1",
            "token": "bbcfce79a2d95037502f7e9a534906d3466c9a1484beb6ea0f4e7be28e8b8ce2"
        },
        {
            "tokenid": "2",
            "token": "fa1258a83d518eabd87698a96bd7f07e5a6ae8aeb8463cae33d50b91dd21bd6d"
        }
    ],
    "id": 0
}
```

[comment]: # ({/14225527-c0623539})

[comment]: # ({39ba5785-39ba5785})
### ソース

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

[comment]: # ({/39ba5785-39ba5785})
