ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Dashboard annotations API > 原文:[https://docs.gitlab.com/ee/api/metrics_dashboard_annotations.html](https://docs.gitlab.com/ee/api/metrics_dashboard_annotations.html) * [Create a new annotation](#create-a-new-annotation) # Dashboard annotations API[](#dashboard-annotations-api "Permalink") 版本历史 * 在 GitLab 12.10 中在禁用的功能标志后面[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29089) . 指标仪表板注释使您可以在单个时间点或整个时间段内指示图形上的事件. ## Create a new annotation[](#create-a-new-annotation "Permalink") ``` POST /environments/:id/metrics_dashboard/annotations/ POST /clusters/:id/metrics_dashboard/annotations/ ``` **注意:** `dashboard_path`的值将被视为 CGI 转义的路径,并自动取消转义. Parameters: | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `dashboard_path` | string | yes | 需要注释的仪表盘的 ID. | | `starting_at` | string | yes | 日期时间字符串,ISO 8601 格式,例如`2016-03-11T03:45:40Z` . 注释的时间戳标记起点. | | `ending_at` | string | no | 日期时间字符串,ISO 8601 格式,例如`2016-03-11T03:45:40Z` . 注释的时间戳标记终点. 如果未提供,注释将在起点显示为单个事件. | | `description` | string | yes | 注释的描述. | ``` curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/environments/1/metrics_dashboard/annotations" \ --data-urlencode "dashboard_path=.gitlab/dashboards/custom_metrics.yml" \ --data-urlencode "starting_at=2016-03-11T03:45:40Z" \ --data-urlencode "description=annotation description" ``` 示例响应: ``` { "id": 4, "starting_at": "2016-04-08T03:45:40.000Z", "ending_at": null, "dashboard_path": ".gitlab/dashboards/custom_metrics.yml", "description": "annotation description", "environment_id": 1, "cluster_id": null } ```