Skip to content

Commit 24a410a

Browse files
timlnxtorkelo
authored andcommitted
docs(preferences): Document user and org preferences (grafana#5087)
closes grafana#5069
1 parent 1033909 commit 24a410a

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

docs/sources/http_api/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ dashboards, creating users and updating data sources.
1818
* [User API](/http_api/user/)
1919
* [Admin API](/http_api/admin/)
2020
* [Snapshot API](/http_api/snapshot/)
21+
* [Preferences API](/http_api/preferences/)
2122
* [Other API](/http_api/other/)
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
----
2+
page_title: Preferences API
3+
page_description: Grafana Preferences API Reference
4+
page_keywords: grafana, preferences, http, api, documentation
5+
---
6+
7+
# User and Org Preferences API
8+
9+
Keys:
10+
11+
- **theme** - One of: ``light``, ``dark``, or an empty string for the default theme
12+
- **homeDashboardId** - The numerical ``:id`` of a favorited dashboard, default: ``0``
13+
- **timezone** - One of: ``utc``, ``browser``, or an empty string for the default
14+
15+
Omitting a key will cause the current value to be replaced with the
16+
system default value.
17+
18+
## Get Current User Prefs
19+
20+
`GET /api/user/preferences`
21+
22+
**Example Request**:
23+
24+
GET /api/user/preferences HTTP/1.1
25+
Accept: application/json
26+
Content-Type: application/json
27+
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
28+
29+
**Example Response**:
30+
31+
HTTP/1.1 200
32+
Content-Type: application/json
33+
34+
{"theme":"","homeDashboardId":0,"timezone":""}
35+
36+
## Update Current User Prefs
37+
38+
`PUT /api/user/preferences`
39+
40+
**Example Request**:
41+
42+
PUT /api/user/preferences HTTP/1.1
43+
Accept: application/json
44+
Content-Type: application/json
45+
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
46+
47+
{
48+
"theme": "",
49+
"homeDashboardId":0,
50+
"timezone":"utc"
51+
}
52+
53+
**Example Response**:
54+
55+
HTTP/1.1 200
56+
Content-Type: text/plain; charset=utf-8
57+
58+
{"message":"Preferences updated"}
59+
60+
## Get Current Org Prefs
61+
62+
`GET /api/org/preferences`
63+
64+
**Example Request**:
65+
66+
GET /api/org/preferences HTTP/1.1
67+
Accept: application/json
68+
Content-Type: application/json
69+
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
70+
71+
**Example Response**:
72+
73+
HTTP/1.1 200
74+
Content-Type: application/json
75+
76+
{"theme":"","homeDashboardId":0,"timezone":""}
77+
78+
## Update Current Org Prefs
79+
80+
`PUT /api/org/preferences`
81+
82+
**Example Request**:
83+
84+
PUT /api/org/preferences HTTP/1.1
85+
Accept: application/json
86+
Content-Type: application/json
87+
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
88+
89+
{
90+
"theme": "",
91+
"homeDashboardId":0,
92+
"timezone":"utc"
93+
}
94+
95+
**Example Response**:
96+
97+
HTTP/1.1 200
98+
Content-Type: text/plain; charset=utf-8
99+
100+
{"message":"Preferences updated"}

0 commit comments

Comments
 (0)