用户和组织偏好设置 API
键
- theme - 以下之一:
light
、dark
,或空字符串表示默认主题 - homeDashboardId - 收藏的仪表盘的数字
:id
,默认值:0
- timezone - 以下之一:
utc
、browser
,或空字符串表示默认值
省略某个键将导致当前值被系统默认值替换。
获取当前用户偏好设置
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": 217,
"homeDashboardUID": "jcIIG-07z",
"timezone": "utc",
"weekStart": "",
"navbar": {
"bookmarkUrls": null
},
"queryHistory": {
"homeTab": ""
}
}
更新当前用户偏好设置
PUT /api/user/preferences
请求示例:
PUT /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"theme": "",
"homeDashboardUID":"home",
"timezone":"utc"
}
响应示例:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}
部分更新当前用户偏好设置
更新一个或多个偏好设置,而不修改其他偏好设置。
PATCH /api/user/preferences
请求示例:
PATCH /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"theme": "dark"
}
响应示例:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}
获取当前组织偏好设置
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": "",
"weekStart": "",
"navbar": {
"bookmarkUrls": null
},
"queryHistory": {
"homeTab": ""
}
}
更新当前组织偏好设置
PUT /api/org/preferences
请求示例:
PUT /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"theme": "",
"homeDashboardUID":"home",
"timezone":"utc"
}
响应示例:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}
部分更新当前组织偏好设置
更新一个或多个偏好设置,而不修改其他偏好设置。
PATCH /api/org/preferences
请求示例:
PATCH /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"theme": "dark"
}
响应示例:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}