Multi-level filtering


#1

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)

   "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" }
      }, ...

#2

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

Maybe that will be helpful for you.


#3

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


#4

I’m glad that helped.