# Refresh all dashboard charts

Requests to refresh all charts in the specified data dashboard. Each chart is submitted independently and its respective return status needs to be checked.

```text
POST https://moi.matrixorigin.cn/newmoi/data-dashboards/{dashboard_id}/refresh
```

## Preparation before calling

Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: Target workspace ID, passed through `X-Workspace-ID` Header.

- `$DASHBOARD_ID`: `dashboard_id` to use, specifying the target resource via the request path.

## Call example

```bash
curl -X POST "https://moi.matrixorigin.cn/newmoi/data-dashboards/$DASHBOARD_ID/refresh" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Path parameters

| Parameters | Type | Is it required | Description |
| --- | --- | --- | --- |
| `dashboard_id` | string | Yes | Data dashboard ID. |
## Successful response


When the request is successful, the data of this operation is returned. Just because the write or run request has been accepted does not mean that the subsequent processing has been completed; please confirm the result based on the return status or subsequent query.

```json
{
  "code": 202,
  "data": {"runs": [{"chart_id": "chart-001", "execution_id": "exec-001", "status": "submitted"}]}
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.runs` | array | The refresh submission results of each chart. |
| `data.runs[].chart_id` | string | Chart ID. |
| `data.runs[].execution_id` | string | Chart run ID; returned when submission is successful. |
| `data.runs[].status` | string | The submission status of this chart. |
| `data.runs[].error` | string | Reason for submission failure; returned upon failure. |

In this document, `[]` after a type denotes an array. In a field path, `[]` denotes each item in an array; for example, `data.runs[].chart_id` is the `chart_id` field of each item in the `data.runs` array.


## Error response

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">integer or string</span></dt><dd>Error code or status.</dd></div>
<div class="mo-api-field"><dt><code>message</code><span class="mo-api-field__type">string</span></dt><dd>Error message.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Error response example</p>
```
```json
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}
```
:::
::::
