Enable notifications for a single device

Daniel3 days ago

From what I understand, when creating a notification I need to relate it to a device using another API endpoint. In the documentation, the body schema is id, type, always, web, mail, sms, calendarId, attributes, but that didn't work. I managed to create it as follows:

await fetch(`/api/notifications`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type,
always: true,
notificators: "web",
calendarId: 0,
attributes: {},
}),
});

I'm having trouble relating the notification created to a single device. Whenever I try to do this, it relates it to all devices, as if I hadn't created the relationship with any device.

await fetch("/api/permissions", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
deviceId: selectedId,
notificationId: json.id,
}),
});

I'm not sure if this part of the API documentation is up to date.

Anton Tananaev3 days ago

Seems like the API reference schema is outdated.

But if you set "always: true", you don't need to link a device.