

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# 設定 API
<a name="v10-Grafana-API-Preferences"></a>

設定 API を使用して、Amazon Managed Grafana ワークスペースでユーザー設定を使用します。

キー:
+ **theme** — 有効な値は `light`、`dark`、またはデフォルトテーマを使用する空の文字列です。
+ **homeDashboardId** — お気に入りのダッシュボードの数値の `:id` です。デフォルトは 0 です。
+ **[タイムゾーン]** — 有効な値は `utc`、`browser`、またはデフォルトを使用する空の文字列です。

キーを省略すると、現在の値はシステムのデフォルト値に置き換えられます。

**注記**  
Amazon Managed Grafana ワークスペースで Grafana API を使用するには、有効なサービスアカウントトークンが必要です。このトークンは API リクエストの `Authorization` フィールドに含めます。

## 現在のユーザー設定の取得
<a name="v10-Grafana-API-Preferences-get"></a>

```
GET /api/user/preferences
```

**リクエストの例**

```
GET /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```

**レスポンスの例**

```
HTTP/1.1 200
Content-Type: application/json

{"theme":"","homeDashboardId":0,"timezone":""}
```

## 現在のユーザー設定の更新
<a name="v10-Grafana-API-Preferences-update"></a>

```
PUT /api/user/preferences
```

**リクエストの例**

```
PUT /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

{
  "theme": "",
  "homeDashboardId":0,
  "timezone":"utc"
}
```

**レスポンスの例**

```
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8

{"message":"Preferences updated"}
```

## 現在の組織設定の取得
<a name="v10-Grafana-API-Preferences-get-org"></a>

```
GET /api/org/preferences
```

**リクエストの例**

```
GET /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```

**レスポンスの例**

```
HTTP/1.1 200
Content-Type: application/json

{"theme":"","homeDashboardId":0,"timezone":""}
```

## 現在の組織設定の更新
<a name="v10-Grafana-API-Playlist-Preferences-update-org"></a>

```
PUT /api/org/preferences
```

**リクエストの例**

```
PUT /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

{
  "theme": "",
  "homeDashboardId":0,
  "timezone":"utc"
}
```

**レスポンスの例**

```
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8

{"message":"Preferences updated"}
```