Mark notifications read or unread
curl --request POST \
--url http://localhost:3000/api/notifications \
--header 'Content-Type: application/json' \
--header 'Origin: <api-key>' \
--data '
{
"action": "mark_unread",
"ids": [
"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90"
]
}
'import requests
url = "http://localhost:3000/api/notifications"
payload = {
"action": "mark_unread",
"ids": ["5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90"]
}
headers = {
"Origin": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Origin: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: 'mark_unread', ids: ['5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90']})
};
fetch('http://localhost:3000/api/notifications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/notifications",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'mark_unread',
'ids' => [
'5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/notifications"
payload := strings.NewReader("{\n \"action\": \"mark_unread\",\n \"ids\": [\n \"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Origin", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/notifications")
.header("Origin", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"mark_unread\",\n \"ids\": [\n \"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/notifications")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Origin"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"mark_unread\",\n \"ids\": [\n \"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"flipped": 1
}{
"error": "Admin token required"
}{
"error": "Admin token required"
}Notifications
Mark notifications read or unread
mark_read marks every notification read, including rows that quiet
hours or the per-type filters are hiding. mark_unread marks the
listed notifications unread again. The bell sends it to undo opening
the feed.
POST
/
api
/
notifications
Mark notifications read or unread
curl --request POST \
--url http://localhost:3000/api/notifications \
--header 'Content-Type: application/json' \
--header 'Origin: <api-key>' \
--data '
{
"action": "mark_unread",
"ids": [
"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90"
]
}
'import requests
url = "http://localhost:3000/api/notifications"
payload = {
"action": "mark_unread",
"ids": ["5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90"]
}
headers = {
"Origin": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Origin: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({action: 'mark_unread', ids: ['5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90']})
};
fetch('http://localhost:3000/api/notifications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/notifications",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'action' => 'mark_unread',
'ids' => [
'5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:3000/api/notifications"
payload := strings.NewReader("{\n \"action\": \"mark_unread\",\n \"ids\": [\n \"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Origin", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:3000/api/notifications")
.header("Origin", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"mark_unread\",\n \"ids\": [\n \"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/notifications")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Origin"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"action\": \"mark_unread\",\n \"ids\": [\n \"5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"flipped": 1
}{
"error": "Admin token required"
}{
"error": "Admin token required"
}Authorizations
Same-origin CSRF check. The Origin header must match the request host;
enforced for every mutating verb (POST, PUT, PATCH, DELETE).
Body
application/json
Available options:
mark_read, mark_unread Example:
"mark_unread"
Notification ids. Required with mark_unread, ignored with
mark_read. Anything that isn't a non-empty string is
skipped, and only the first 200 of the rest are used.
Example:
["5b0c2f8e-3a47-4d1e-9f3c-2b8e6a1d7c90"]