ben*_*tek 5 json json-api jsonapi-resources
问题是关于JSON API规范以及请求的正确处理方式(我正在使用ruby on rails和json api resources gem,但这还是一个普遍的问题,我知道如何实现它,我只想遵循JSON的规则API位于:http : //jsonapi.org/format/)
情况一:
www.library.com/shelves?include=books情况2:
我想获取所有书籍,但仅获取标记为未读的书籍
我应该使用的get是:
www.library.com/books?filter[unread]=true
设计包含未读书籍的所有书架的要求的正确方法是什么?
想不通这个
www.library.com/shelves?include=books&filter[books.unread]=true ?
www.library.com/shelves?include=unread_books?<-必须指定其他资源,即未读的书
www.library.com/shelves?filter[books.unread]=true ?
最正确的方法是什么?
编辑
与我的技术负责人和其他一些程序员交谈后,在这种情况下,最优先选择第一个选项
小智 6
我敢打赌第一个:
www.library.com/shelves?include=books&filter[books.unread]=true
Run Code Online (Sandbox Code Playgroud)