oncall-engine/docs/sources/oncall-api-reference/postmortem_messages.md
Michael Derynck 6b40f95033 World, meet OnCall!
Co-authored-by: Eve832 <eve.meelan@grafana.com>
    Co-authored-by: Francisco Montes de Oca <nevermind89x@gmail.com>
    Co-authored-by: Ildar Iskhakov <ildar.iskhakov@grafana.com>
    Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
    Co-authored-by: Julia <ferril.darkdiver@gmail.com>
    Co-authored-by: maskin25 <kengurek@gmail.com>
    Co-authored-by: Matias Bordese <mbordese@gmail.com>
    Co-authored-by: Matvey Kukuy <motakuk@gmail.com>
    Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
    Co-authored-by: Richard Hartmann <richih@richih.org>
    Co-authored-by: Robby Milo <robbymilo@fastmail.com>
    Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
    Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
    Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2022-06-03 08:09:47 -06:00

3 KiB

+++ title = "Postmortem Messages HTTP API" aliases = ["/docs/grafana-cloud/oncall/oncall-api-reference/postmortem_messages/"] weight = 900 draft = true +++

Create a postmortem message

curl "{{API_URL}}/api/v1/postmortem_messages/" \
  --request POST \
  --header "Authorization: meowmeowmeow" \
  --header "Content-Type: application/json" \
  --data '{
      "alert_group_id": "I68T24C13IFW1",
      "text": "Demo postmortem message"
  }'

The above command returns JSON structured in the following way:

{
    "id": "M4BTQUS3PRHYQ",
    "alert_group_id": "I68T24C13IFW1",
    "author": "U4DNY931HHJS5",
    "source": "web",
    "created_at": "2020-06-19T12:40:01.429805Z",
    "text": "Demo postmortem message"
}

HTTP request

POST {{API_URL}}/api/v1/postmortem_messages/

Get a postmortem message

curl "{{API_URL}}/api/v1/postmortem_messages/M4BTQUS3PRHYQ/" \
  --request GET \
  --header "Authorization: meowmeowmeow" \
  --header "Content-Type: application/json"

The above command returns JSON structured in the following way:

{
    "id": "M4BTQUS3PRHYQ",
    "alert_group_id": "I68T24C13IFW1",
    "author": "U4DNY931HHJS5",
    "source": "web",
    "created_at": "2020-06-19T12:40:01.429805Z",
    "text": "Demo postmortem message"
}

HTTP request

GET {{API_URL}}/api/v1/postmortem_messages/<POSTMORTEM_MESSAGE_ID>/

List postmortem messages

curl "{{API_URL}}/api/v1/postmortem_messages/" \
  --request GET \
  --header "Authorization: meowmeowmeow" \
  --header "Content-Type: application/json"

The above command returns JSON structured in the following way:

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "M4BTQUS3PRHYQ",
            "alert_group_id": "I68T24C13IFW1",
            "author": "U4DNY931HHJS5",
            "source": "web",
            "created_at": "2020-06-19T12:40:01.429805Z",
            "text": "Demo postmortem message"
        }
    ]
}

The following available filter parameter should be provided as a GET argument:

  • alert_group_id

HTTP request

GET {{API_URL}}/api/v1/postmortem_messages/

Update a postmortem message

curl "{{API_URL}}/api/v1/postmortem_messages/M4BTQUS3PRHYQ/" \
  --request PUT \
  --header "Authorization: meowmeowmeow" \
  --header "Content-Type: application/json" \
  --data '{
      "text": "Demo postmortem message"
  }'

The above command returns JSON structured in the following way:

{
    "id": "M4BTQUS3PRHYQ",
    "alert_group_id": "I68T24C13IFW1",
    "author": "U4DNY931HHJS5",
    "source": "web",
    "created_at": "2020-06-19T12:40:01.429805Z",
    "text": "Demo postmortem message"
}

HTTP request

PUT {{API_URL}}/api/v1/postmortem_messages/<POSTMORTEM_MESSAGE_ID>/

Delete a postmortem message

curl "{{API_URL}}/api/v1/postmortem_messages/M4BTQUS3PRHYQ/" \
  --request DELETE \
  --header "Authorization: meowmeowmeow"

HTTP request

DELETE {{API_URL}}/api/v1/postmortem_messages/<POSTMORTEM_MESSAGE_ID>/