Esc
Tracklytic
AnleitungenAPI-ReferenzSDKsChangelogTracklytic öffnen

Log ergänzen

View as MarkdownThe page as plain text

Einen Verlaufseintrag zu einem Event hinzufügen.

POST/v1/event/{eventId}/logs

Authentifizierung: Benutzer-Access-JWT mit Projektzugriff.

Body

type und message sind erforderlich. type erlaubt info, success, warning, error, manual. Optional: details als Objekt, actionId als interne Action-ID, userId als String. Der Server ergänzt den Zeitpunkt.

Antwort

HTTP 200 liefert das Event mit ergänztem Verlauf. Das Beispiel ist gekürzt.

Request

curl -X POST 'https://api.tracklytic.de/v1/event/EVENT_ID/logs' \
  -H "Authorization: Bearer $TRACKLYTIC_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "type": "info",
  "message": "Prüfung abgeschlossen",
  "details": {
    "checks": 3
  }
}'
const response = await fetch("https://api.tracklytic.de/v1/event/EVENT_ID/logs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRACKLYTIC_ACCESS_TOKEN}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(
    {
      "type": "info",
      "message": "Prüfung abgeschlossen",
      "details": {
        "checks": 3
      }
    }
  )
});

if (!response.ok) throw new Error(await response.text());
const result = await response.json();
import json
import os
from urllib.request import Request, urlopen

payload = {
  "type": "info",
  "message": "Prüfung abgeschlossen",
  "details": {
    "checks": 3
  }
}

request = Request(
    "https://api.tracklytic.de/v1/event/EVENT_ID/logs",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["TRACKLYTIC_ACCESS_TOKEN"],
        "Content-Type": "application/json"
    },
    data=json.dumps(payload).encode("utf-8")
)

with urlopen(request) as response:
    result = json.load(response)

Response

200
{
  "id": "EVENT_ID",
  "logs": [
    {
      "type": "info",
      "message": "Prüfung abgeschlossen",
      "details": {
        "checks": 3
      }
    }
  ]
}