Esc
Tracklytic
AnleitungenAPI-ReferenzSDKsChangelogTracklytic öffnen

Insight setzen

View as MarkdownThe page as plain text

Einen benannten Zahlen- oder Textwert erstellen oder ersetzen.

POST/v1/insight

Authentifizierung: API-Token.

Body

Feld Typ Erforderlich Bedeutung
project string Ja Projekt-Slug.
title string Ja Insight-Titel; identifiziert zusammen mit dem Projekt den Wert.
value number oder string Ja Neuer Wert. Objekte sind hier nicht zulässig.
icon string Nein Beispielsweise ein Emoji.
notify boolean Nein Benachrichtigung anfordern oder unterdrücken.

Antwort

HTTP 201 mit {}. Ein bestehender Wert wird ersetzt; verwende Insight verändern für eine relative Änderung.

Request

curl -X POST 'https://api.tracklytic.de/v1/insight' \
  -H "Authorization: Bearer $TRACKLYTIC_API_TOKEN" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "project": "my-project",
  "title": "Aktive Abonnements",
  "value": 1250,
  "notify": false
}'
const response = await fetch("https://api.tracklytic.de/v1/insight", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRACKLYTIC_API_TOKEN}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify(
    {
      "project": "my-project",
      "title": "Aktive Abonnements",
      "value": 1250,
      "notify": false
    }
  )
});

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 = {
  "project": "my-project",
  "title": "Aktive Abonnements",
  "value": 1250,
  "notify": False
}

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

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

Response

201
{}