# Update attribute of all objects in filter

**URL:** <https://discuss.jsonapi.org/t/update-attribute-of-all-objects-in-filter/2265>\
**Category:** Uncategorized\
**Created:** [June 30, 2021, 7:48pm UTC](https://discuss.jsonapi.org/t/update-attribute-of-all-objects-in-filter/2265 "2021-06-30T19:48:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xaleph](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/xaleph/32/752_2.png) [@Xaleph](https://discuss.jsonapi.org/u/Xaleph)\
**Post date:** [June 30, 2021, 7:48pm UTC](https://discuss.jsonapi.org/t/update-attribute-of-all-objects-in-filter/2265/1 "2021-06-30T19:48:19Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Xaleph](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/xaleph/32/752_2.png) [@Xaleph](https://discuss.jsonapi.org/u/Xaleph)\
**Post date:** [July 1, 2021, 8:21pm UTC](https://discuss.jsonapi.org/t/update-attribute-of-all-objects-in-filter/2265/2 "2021-07-01T20:21:00Z")

</div>

I was thinking something similar to this:

```auto
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)

```auto
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 
      }
    }
  }]
}

```
