# Update data dashboard

Update the name, description, and data source of the specified data dashboard.

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

## 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.

## Request body

Replace caller-specific values in the example with actual values.

::::{div} mo-api-split
:::{div} mo-api-split-main
```{raw} html
<dl class="mo-api-fields">
<div class="mo-api-field"><dt><code>name</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Data dashboard name.</dd></div>
<div class="mo-api-field"><dt><code>description</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Data dashboard description.</dd></div>
<div class="mo-api-field"><dt><code>sources</code><span class="mo-api-field__type">array</span><span class="mo-api-field__required">Required</span></dt><dd>List of data sources.</dd></div>
<div class="mo-api-field"><dt><code>sources[].table_id</code><span class="mo-api-field__type">integer</span><span class="mo-api-field__required">Required</span></dt><dd>Data source table ID.</dd></div>
</dl>
```
:::
:::{div} mo-api-split-aside
```{raw} html
<p class="mo-api-example-label">Request example</p>
```
```bash
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/data-dashboards/$DASHBOARD_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "销售概览",
    "description": "更新后的说明",
    "sources": [{"table_id": 1001}]
  }'
```
:::
::::
## Successful response

When the update is successful, the `data.updated` in the response is `true`.

```json
{
  "code": 0,
  "data": {"updated": true}
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `data.updated` | boolean | Whether it has been updated. |

## 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": 2,
  "message": "invalid argument",
  "details": {
    "domain": "moi-core.catalog.data_dashboard",
    "reason": "DATA_DASHBOARD_INVALID_REQUEST"
  }
}
```
:::
::::
