summaryrefslogtreecommitdiff
path: root/doc/api/alert_management_alerts.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/alert_management_alerts.md')
-rw-r--r--doc/api/alert_management_alerts.md60
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/api/alert_management_alerts.md b/doc/api/alert_management_alerts.md
index ce27249bddc..8fde91dd7f2 100644
--- a/doc/api/alert_management_alerts.md
+++ b/doc/api/alert_management_alerts.md
@@ -11,6 +11,35 @@ This is the documentation of Alert Management Alerts API.
NOTE:
This API is limited to metric images. For more API endpoints please refer to the [GraphQL API](graphql/reference/index.md#alertmanagementalert).
+## Upload metric image
+
+```plaintext
+POST /projects/:id/alert_management_alerts/:alert_iid/metric_images
+```
+
+| Attribute | Type | Required | Description |
+|-------------|---------|----------|--------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. |
+| `alert_iid` | integer | yes | The internal ID of a project's alert. |
+
+```shell
+curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form 'file=@/path/to/file.png' \
+--form 'url=http://example.com' --form 'url_text=Example website' "https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images"
+```
+
+Example response:
+
+```json
+{
+ "id": 17,
+ "created_at": "2020-11-12T20:07:58.156Z",
+ "filename": "sample_2054",
+ "file_path": "/uploads/-/system/alert_metric_image/file/17/sample_2054.png",
+ "url": "example.com/metric",
+ "url_text": "An example metric"
+}
+```
+
## List metric images
```plaintext
@@ -48,3 +77,34 @@ Example response:
}
]
```
+
+## Update metric image
+
+```plaintext
+PUT /projects/:id/alert_management_alerts/:alert_iid/metric_image/:image_id
+```
+
+| Attribute | Type | Required | Description |
+|-------------|---------|----------|--------------------------------------|
+| `id` | integer/string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) owned by the authenticated user. |
+| `alert_iid` | integer | yes | The internal ID of a project's alert. |
+| `image_id` | integer | yes | The ID of the image. |
+| `url` | string | no | The URL to view more metrics information. |
+| `url_text` | string | no | A description of the image or URL. |
+
+```shell
+curl --header "PRIVATE-TOKEN: <your_access_token>" --request PUT --form 'url=http://example.com' --form 'url_text=Example website' "https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images/1"
+```
+
+Example response:
+
+```json
+{
+ "id": 23,
+ "created_at": "2020-11-13T00:06:18.084Z",
+ "filename": "file.png",
+ "file_path": "/uploads/-/system/alert_metric_image/file/23/file.png",
+ "url": "http://example.com",
+ "url_text": "Example website"
+}
+```