# Multi-level filtering

**URL:** <https://discuss.jsonapi.org/t/multi-level-filtering/358>\
**Category:** Uncategorized\
**Created:** [February 24, 2016, 3:07pm UTC](https://discuss.jsonapi.org/t/multi-level-filtering/358 "2016-02-24T15:07:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmucklo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/mmucklo/32/160_2.png) [@mmucklo](https://discuss.jsonapi.org/u/mmucklo)\
**Post date:** [February 24, 2016, 3:07pm UTC](https://discuss.jsonapi.org/t/multi-level-filtering/358/1 "2016-02-24T15:07:42Z")

</div>

For filters, what is the recommended way to filter on attributes in related resources.

Would this filtering strategy be acceptable / recommended:

**Filter BY ID:** filter[author]=9  
**Filter By Author Last Name:** filter[author][last-name]=Smith

For the below example data set (taken from [jsonapi.org](http://jsonapi.org))

```auto
   "data": [{
    "type": "articles",
    "id": "1",
    "attributes": {
      "title": "JSON API paints my bikeshed!"
    },
    "relationships": {
      "author": {
        "links": {
          "self": "http://example.com/articles/1/relationships/author",
          "related": "http://example.com/articles/1/author"
        },
        "data": { "type": "people", "id": "9" }
      }, ...

```

---

<div class="post-metadata">

**Author:** ![e0ipso](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/e0ipso/32/104_2.png) [@e0ipso](https://discuss.jsonapi.org/u/e0ipso)\
**Post date:** [February 25, 2016, 7:42am UTC](https://discuss.jsonapi.org/t/multi-level-filtering/358/2 "2016-02-25T07:42:09Z")

</div>

I am using this extension I wrote: [https://gist.github.com/e0ipso/1acbced683908ff631e3](https://gist.github.com/e0ipso/1acbced683908ff631e3)

Maybe that will be helpful for you.

---

<div class="post-metadata">

**Author:** ![mmucklo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/mmucklo/32/160_2.png) [@mmucklo](https://discuss.jsonapi.org/u/mmucklo)\
**Post date:** [March 15, 2016, 3:04pm UTC](https://discuss.jsonapi.org/t/multi-level-filtering/358/3 "2016-03-15T15:04:21Z")

</div>

thanks, taken a look and the concepts within have been useful.

---

<div class="post-metadata">

**Author:** ![e0ipso](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/e0ipso/32/104_2.png) [@e0ipso](https://discuss.jsonapi.org/u/e0ipso)\
**Post date:** [April 26, 2016, 7:19am UTC](https://discuss.jsonapi.org/t/multi-level-filtering/358/4 "2016-04-26T07:19:09Z")

</div>

I’m glad that helped.
