Ir al contenido

Post an alert to an automation

POST/api/alerts/{id}

Polaris' JSON, with the alert address's secret as a bearer token. The automation whose trigger owns the address runs. ntfy's JSON publish is also taken here, with the secret as its topic field. Unknown fields are refused.

Necesita una clave de API en la cabecera Authorization.

En esta página

Parámetros

CampoEnTipoDescripción
idobligatoriorutastring
The alert address's id.
  • formato: uuid

Cuerpo

CampoTipoDescripción
messagestring
  • long. máx.: 16384
titlestring
  • long. máx.: 250
severitynumber | string
prioritynumber | string
tagsstring | string[]
clickstring
  • long. máx.: 2048
iconstring
  • long. máx.: 2048
attachstring
  • long. máx.: 2048
markdownboolean
actionsstring | object[]
dedupKeystring
  • long. máx.: 200
Esquema JSON
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "maxLength": 16384
    },
    "title": {
      "type": "string",
      "maxLength": 250
    },
    "severity": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "maxLength": 10
        }
      ]
    },
    "priority": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "maxLength": 10
        }
      ]
    },
    "tags": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 510
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 50
          }
        }
      ]
    },
    "click": {
      "type": "string",
      "maxLength": 2048
    },
    "icon": {
      "type": "string",
      "maxLength": 2048
    },
    "attach": {
      "type": "string",
      "maxLength": 2048
    },
    "markdown": {
      "type": "boolean"
    },
    "actions": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 6384
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "maxLength": 20
              },
              "label": {
                "type": "string",
                "maxLength": 60
              },
              "url": {
                "type": "string",
                "maxLength": 2048
              },
              "clear": {
                "type": "boolean"
              },
              "method": {
                "type": "string",
                "maxLength": 10
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 500
                }
              },
              "body": {
                "type": "string",
                "maxLength": 4096
              },
              "intent": {
                "type": "string",
                "maxLength": 200
              },
              "extras": {
                "type": "object",
                "additionalProperties": {
                  "type": "string",
                  "maxLength": 500
                }
              }
            },
            "required": [
              "action",
              "label"
            ],
            "additionalProperties": false
          }
        }
      ]
    },
    "dedupKey": {
      "type": "string",
      "maxLength": 200
    }
  },
  "additionalProperties": false
}

Petición de ejemplo

curl -X POST "https://polaris.example.com/api/alerts/{id}" \
  -H "Authorization: Bearer $POLARIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "string",
  "title": "string",
  "severity": 0,
  "priority": 0,
  "tags": "string",
  "click": "string",
  "icon": "string",
  "attach": "string",
  "markdown": false,
  "actions": "string",
  "dedupKey": "string"
}'

Respuestas

EstadoQué es
200OK

También puede dar los errores comunes 400, 401, 403, 404, 429. Ver errores comunes