Skip to content

Add upload & update endpoints for alert metrics

Sean Arnold requested to merge 340852-alert-metric-image-upload into master

What does this MR do and why?

This adds upload and update endpoints for Alert Management Alert Metric Images.

Two MRs have been merged already on this feature:

API Request & responses

Upload Image

Curl
curl --location --request POST 'http://gdk.test:3000/api/v4/projects/6/alert_management_alerts/12/metric_images' \
--header 'PRIVATE-TOKEN: glpat-DEpkrRZUMVgm6ixjRGCr' \
--form 'file=@"/Users/seanarnold/Downloads/s7mnOhs.jpg"' \
--form 'url="http://gitlab.com"' \
--form 'url_text="Grafana metric"'
Response
{
    "id": 4,
    "created_at": "2022-01-27T02:25:13.343Z",
    "filename": "s7mnOhs.jpg",
    "file_path": "http://gdk.test:3000/uploads/-/system/alert_management_metric_image/file/4/s7mnOhs.jpg",
    "url": "http://gitlab.com",
    "url_text": "Grafana metric"
}

Update images

Curl
curl --location --request PUT 'http://gdk.test:3000/api/v4/projects/6/alert_management_alerts/12/metric_images/2' \
--header 'PRIVATE-TOKEN: glpat-DEpkrRZUMVgm6ixjRGCr' \
--form 'url="http://gitlab.com"'
Response
{
    "id": 2,
    "created_at": "2022-01-27T02:17:39.419Z",
    "filename": "s7mnOhs.jpg",
    "file_path": "http://gdk.test:3000/uploads/-/system/alert_management_metric_image/file/2/s7mnOhs.jpg",
    "url": "http://gitlab.com",
    "url_text": "Grafana metric"
}

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #340852 (closed)

Edited by Sean Arnold

Merge request reports