用户星标的指标仪表盘 API
所有级别

星标的仪表盘功能可以在选择列表顶部显示收藏的仪表盘,从而使用户更容易导航到常用仪表盘。

向仪表盘添加星标#

引入于极狐GitLab 13.0。

plaintext
POST /projects/:id/metrics/user_starred_dashboards

参数:

参数类型是否必需描述
idinteger/stringyesID 或 URL 编码的项目路径
dashboard_pathstringyesURL 编码的文件路径,该文件定义应该被标为收藏的仪表盘
shell
curl --header 'Private-Token: <your_access_token>' "https://gitlab.example.com/api/v4/projects/20/metrics/user_starred_dashboards" \ --data-urlencode "dashboard_path=config/prometheus/dashboards/common_metrics.yml"

响应示例:

json
1{ 2 "id": 5, 3 "dashboard_path": "config/prometheus/common_metrics.yml", 4 "user_id": 1, 5 "project_id": 20 6}

从仪表盘移除星标#

引入于极狐GitLab 13.0。

plaintext
DELETE /projects/:id/metrics/user_starred_dashboards

参数:

参数类型是否必需描述
idinteger/stringyesID 或 URL 编码的项目路径
dashboard_pathstringnoURL 编码的文件路径,该文件定义不应被标为收藏的仪表盘。如未提供,给定项目中的所有仪表盘都会被取消收藏
shell
curl --request DELETE --header 'Private-Token: <your_access_token>' "https://gitlab.example.com/api/v4/projects/20/metrics/user_starred_dashboards" \ --data-urlencode "dashboard_path=config/prometheus/dashboards/common_metrics.yml"

响应示例:

json
{ "deleted_rows": 1 }