正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

Alert management alerts API

  • プラン: Free、Premium、Ultimate
  • 提供形態: GitLab.com、GitLab Self-Managed、GitLab Dedicated

このAPIを使用して、メトリクスのアラートの画像とやり取りします。

追加のエンドポイントは、GraphQL APIで使用できます。

メトリクスの画像をアップロードする

POST /projects/:id/alert_management_alerts/:alert_iid/metric_images
属性必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
alert_iid整数はいプロジェクトのアラートの内部ID。

リクエスト例:

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' \
  --url "https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images"

レスポンス例:

{
  "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":"https://example.com/metric",
  "url_text":"An example metric"
}

メトリクスの画像をリストする

GET /projects/:id/alert_management_alerts/:alert_iid/metric_images
属性必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
alert_iid整数はいプロジェクトのアラートの内部ID。

リクエスト例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images"

レスポンス例:

[
  {
    "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":"https://example.com/metric",
    "url_text":"An example metric"
  },
  {
    "id":18,
    "created_at":"2020-11-12T20:14:26.441Z",
    "filename":"sample_2054",
    "file_path":"/uploads/-/system/alert_metric_image/file/18/sample_2054.png",
    "url":"https://example.com/metric",
    "url_text":"An example metric"
  }
]

メトリクスの画像を更新する

PUT /projects/:id/alert_management_alerts/:alert_iid/metric_images/:image_id
属性必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
alert_iid整数はいプロジェクトのアラートの内部ID。
image_id整数はい画像のID。
url文字列いいえ詳細なメトリクス情報を表示するためのURL。
url_text文字列いいえ画像またはURLの説明。

リクエスト例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --request PUT  --form 'url=http://example.com' \
  --form 'url_text=Example website' \
  --url "https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images/1"

レスポンス例:

{
  "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":"https://example.com/metric",
  "url_text":"An example metric"
}

メトリクスの画像を削除する

DELETE /projects/:id/alert_management_alerts/:alert_iid/metric_images/:image_id
属性必須説明
id整数または文字列はいプロジェクトのIDまたはURLエンコードされたパス
alert_iid整数はいプロジェクトのアラートの内部ID。
image_id整数はい画像のID。

リクエスト例:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url  "https://gitlab.example.com/api/v4/projects/5/alert_management_alerts/93/metric_images/1"

次のステータスコードを返すことができます:

  • 画像が正常に削除された場合は204 No Content
  • 画像を削除できなかった場合は422 Unprocessable