I know this is related to bulk updates, but instead of updating individual objects all at once, I want to be able to mark all messages as “read” or “unread” (and also “archived” and not archived). The attributes I’m updating are is_read and is_archived, both are boolean. Is it possible to update all messages using a PATCH json:api approach - maybe even adding some kind of filter to which messages should be updated?
I’ve read through the github issues, multiple forums/posts, and read through the atomic extension but I didn’t see something (or maybe I misunderstood/misread it) that fit this use-case. Thank you for any help in advance!
POST /operations HTTP/1.1
Host: example.org
Content-Type: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
Accept: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
{
"atomic:operations": [{
"op": "update",
"href": "/messages",
"data": {
"type": "messages"
"attributes": { "is_read": true },
"meta": {
"filter" : {
//
// ...jsonlogic or RSQL/FIQL filter here..
// where user id is current user - or where messages that are is_read == false
}
}
}
}]
}
or this (all meta)
POST /operations HTTP/1.1
Host: example.org
Content-Type: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
Accept: application/vnd.api+json;ext="https://jsonapi.org/ext/atomic"
{
"atomic:operations": [{
"op": "update",
"href": "/messages",
"meta": {
"type": "messages"
"attributes": { "is_read": true },
"filter": {
// ...jsonlogic or RSQL/FIQL filter here...
// where user id is current user - or where messages that are is_read == false
// only messages where the relationship is xyz with some parent forum or something
}
}
}]
}