blob: 7c743a50384896b945b97f9af22dfc4d5c2f5bb4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
---
stage: Monitor
group: Health
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: concepts, howto
---
# User-starred metrics dashboards API **(CORE)**
The starred dashboard feature makes navigating to frequently-used dashboards easier
by displaying favorited dashboards at the top of the select list.
## Add a star to a dashboard
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31316) in GitLab 13.0.
```plaintext
POST /projects/:id/metrics/user_starred_dashboards
```
Parameters:
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
| `dashboard_path` | string | yes | URL-encoded path to file defining the dashboard which should be marked as favorite. |
```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"
```
Example Response:
```json
{
"id": 5,
"dashboard_path": "config/prometheus/common_metrics.yml",
"user_id": 1,
"project_id": 20
}
```
## Remove a star from a dashboard
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31892) in GitLab 13.0.
```plaintext
DELETE /projects/:id/metrics/user_starred_dashboards
```
Parameters:
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) |
| `dashboard_path` | string | no | URL-encoded path to file defining the dashboard which should no longer be marked as favorite. When not supplied, all dashboards within given projects are removed from favorites. |
```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"
```
Example Response:
```json
{
"deleted_rows": 1
}
```
|