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.
En esta página
Parámetros
| Campo | En | Tipo | Descripción |
|---|---|---|---|
idobligatorio | ruta | string | The alert address's id.
|
Cuerpo
| Campo | Tipo | Descripción |
|---|---|---|
message | string |
|
title | string |
|
severity | number | string | |
priority | number | string | |
tags | string | string[] | |
click | string |
|
icon | string |
|
attach | string |
|
markdown | boolean | |
actions | string | object[] | |
dedupKey | string |
|
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
| Estado | Qué es |
|---|---|
200 | OK |
También puede dar los errores comunes 400, 401, 403, 404, 429. Ver errores comunes