Skip to content

API reference / RivetIT

Notifications

GET /notifications Bearer token or API key

List undismissed notifications (paged)

Parameters

NameInTypeDescription
pagequeryinteger
limitqueryinteger

Example request

curl "https://YOUR-HOST/api/v1/notifications" \
  -H "Authorization: Bearer $TOKEN"
import requests

response = requests.get(
    "https://YOUR-HOST/api/v1/notifications",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
print(response.json())
const response = await fetch("https://YOUR-HOST/api/v1/notifications", {
  method: "GET",
  headers: { "Authorization": `Bearer ${TOKEN}` },
});
const data = await response.json();
$ch = curl_init("https://YOUR-HOST/api/v1/notifications");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
]);
$data = json_decode(curl_exec($ch), true);

Responses

200Paged notification list

FieldTypeDescription
data array of object
data[].id integer
data[].type string 'approval' for an approval request (route on it with kind + ref_id); otherwise the notification category, e.g. Ticket
data[].message string
data[].action string
data[].timestamp string
data[].kind string (catalog_request | workflow_task) Only when type is approval
data[].ref_id integer Only when type is approval: the approval id to pass to POST /approvals
total integer
Example response
json
{
    "data": [
        {
            "id": 1,
            "type": "string",
            "message": "string",
            "action": "string",
            "timestamp": "string",
            "kind": "catalog_request",
            "ref_id": 1
        }
    ],
    "total": 1
}
POST /notifications/{id}/read Bearer token or API key

Mark a single notification read/dismissed

Parameters

NameInTypeDescription
idrequiredpathinteger

Example request

curl -X POST "https://YOUR-HOST/api/v1/notifications/1/read" \
  -H "Authorization: Bearer $TOKEN"
import requests

response = requests.post(
    "https://YOUR-HOST/api/v1/notifications/1/read",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
print(response.json())
const response = await fetch("https://YOUR-HOST/api/v1/notifications/1/read", {
  method: "POST",
  headers: { "Authorization": `Bearer ${TOKEN}` },
});
const data = await response.json();
$ch = curl_init("https://YOUR-HOST/api/v1/notifications/1/read");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
]);
$data = json_decode(curl_exec($ch), true);

Responses

200Success

FieldTypeDescription
ok boolean
Example response
json
{
    "ok": true
}
POST /notifications/read-all Bearer token or API key

Mark all notifications read/dismissed

Example request

curl -X POST "https://YOUR-HOST/api/v1/notifications/read-all" \
  -H "Authorization: Bearer $TOKEN"
import requests

response = requests.post(
    "https://YOUR-HOST/api/v1/notifications/read-all",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
print(response.json())
const response = await fetch("https://YOUR-HOST/api/v1/notifications/read-all", {
  method: "POST",
  headers: { "Authorization": `Bearer ${TOKEN}` },
});
const data = await response.json();
$ch = curl_init("https://YOUR-HOST/api/v1/notifications/read-all");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
]);
$data = json_decode(curl_exec($ch), true);

Responses

200Success

FieldTypeDescription
ok boolean
Example response
json
{
    "ok": true
}
GET /notifications/stream Bearer token or API key

Server-Sent Events stream of new notifications

Example request

curl "https://YOUR-HOST/api/v1/notifications/stream" \
  -H "Authorization: Bearer $TOKEN"
import requests

response = requests.get(
    "https://YOUR-HOST/api/v1/notifications/stream",
    headers={"Authorization": f"Bearer {TOKEN}"},
)
print(response.json())
const response = await fetch("https://YOUR-HOST/api/v1/notifications/stream", {
  method: "GET",
  headers: { "Authorization": `Bearer ${TOKEN}` },
});
const data = await response.json();
$ch = curl_init("https://YOUR-HOST/api/v1/notifications/stream");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => ["Authorization: Bearer $token"],
]);
$data = json_decode(curl_exec($ch), true);

Responses

200SSE stream

Example response
json
"string"