beniutek beniutek - 1 year ago 116
JSON Question

JSON API filter included resources

The question is about JSON API specification and how properly do a request
(I'm using ruby on rails and the json api resources gem but that's a general question anyway, I know how to implement it, I just want to follow the rules of JSON API at:

Situation 1:

  • I want to get all shelves

  • I want to include all books that are on those shelves

  • The get I'm supposed to use in this case is:

Situation 2:

  • I want to get all books but only books that are marked as unread

  • The get I'm supposed to use is:[unread]=true

What would be correct way of designing request for all shelves with included unread books?

Can't figure this one out[books.unread]=true
? <- would have to specify another resource, books that are unread[books.unread]=true

What's the most correct way of doing this?


After speaking with my tech lead and a few other programmers, the first options is favoured the most in such cases

Answer Source

I would bet on the first one:[books.unread]=true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download