[comment]: # ({9793e988-9793e988})
# report.create

[comment]: # ({/9793e988-9793e988})

[comment]: # ({ea36381d-a8301e64})
### 説明

`object report.create(object/array reports)`

このメソッドは新しい定期レポートを作成するためのものです。

::: noteclassic
このメソッドは*管理者*および*スーパ管理者*ユーザータイプでのみ利用可能です。メソッドの呼び出し権限はユーザーロールの設定で取り消すことができます。詳細は[ユーザーロール](/manual/web_interface/frontend_sections/users/user_roles)を参照してください。
:::

[comment]: # ({/ea36381d-a8301e64})

[comment]: # ({352998e1-869414cf})
### パラメータ

`(object/array)` 作成するスケジュールレポート。

このメソッドは、[標準のスケジュールレポートのプロパティ](object#report)に加えて、以下のパラメータを受け付けます。

|パラメータ|[型](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|users|object/array|レポートの送信先となる[ユーザー](object#users)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `user_groups` が設定されていない場合は*必須*|
|user\_groups|object/array|レポートの送信先となる[ユーザーグループ](object#user-groups)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `users` が設定されていない場合は*必須*|

[comment]: # ({/352998e1-869414cf})

[comment]: # ({05ef7a50-05ef7a50})
### 戻り値

`(object)` `reportids`プロパティの下で作成されたスケジュールされたレポートのIDを含むオブジェクトを返します。 返されるIDの順序は、渡されたスケジュール済みレポートの順序と一致します。

[comment]: # ({/05ef7a50-05ef7a50})

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

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

[comment]: # ({05ea3a37-1cfccf99})
#### スケジュールレポートの作成

2021-04-01から2021-08-31まで、毎週月曜日から金曜日の12:00に前週分の週次レポートを作成します。

[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "report.create",
    "params": {
        "userid": "1",
        "name": "Weekly report",
        "dashboardid": "1",
        "period": "1",
        "cycle": "1",
        "start_time": "43200",
        "weekdays": "31",
        "active_since": "2021-04-01",
        "active_till": "2021-08-31",
        "subject": "Weekly report",
        "message": "Report accompanying text",
        "status": "1",
        "description": "Report description",
        "users": [
            {
                "userid": "1",
                "access_userid": "1",
                "exclude": "0"
            },
            {
                "userid": "2",
                "access_userid": "0",
                "exclude": "1"
            }
        ],
        "user_groups": [
            {
                "usrgrpid": "7",
                "access_userid": "0"
            }
        ]
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "reportids": [
            "1"
        ]
    },
    "id": 1
}
```

[comment]: # ({/05ea3a37-1cfccf99})

[comment]: # ({24bb6b3b-c52572c8})
### 関連項目

-   [ユーザー](object#users)
-   [ユーザーグループ](object#user-groups)

[comment]: # ({/24bb6b3b-c52572c8})

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

CReport::create() in *ui/include/classes/api/services/CReport.php*.

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