Skip to content

Add delete endpoint for Alert metric images

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

What does this MR do and why?

This introduces a Delete API for Alert Management Metric Images.

Previous MRs:

Delete images

Curl
curl --location --request DELETE '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
<204 response>

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

How to set up and validate locally

First create an alert:

  1. Navigate to Settings > Monitor > Alerts > Current integrations
  2. Create & enable a new HTTP Endpoint alert integration if none exist
  3. For an existing integration, click Screen_Shot_2022-02-03_at_6.49.45_PM > Send test alert to trigger a test with a sample payload, like this one:
    • {"title":"Triggering a test alert to associate with an incident"}

Then, create a metric image:

file = Rack::Test::UploadedFile.new('spec/fixtures/rails_sample.jpg', 'image/jpg')

alert = AlertManagement::Alert.last

alert.metric_images.create(file: file, url: 'http://www.gitlab.com', url_text: 'Example metric')

Then call the API using the example above.

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