In a REST api, what is the most efficient way to handle user data for elements?
For example, suppose there are item resources that can be saved. The list of items can be accessed:
https://myservice.com/api/items (Full list) https://myservice.com/api/items/{id} (Single item)
What returns
{ { 'name': 'name 1' }, { 'name': 'name 2' }, }
Each item can be saved by the user ( https://myservice.com/api/user/{id} ), and a list of these favorites will be available at:
https://myservice.com/api/user/{id}/favorites
This whole installation is not stateless; however, there may be hundreds of favorites, and a complete list may not be necessary.
Q: By supporting a stand-alone system, what is the best way to combine receiving an item with specific user data?
i.e. Reasonable or believable to get a list of user-specific items:
https://myservice.com/api/items?user={id} { { 'name': 'name 1', 'isFavourite':true }, { 'name': 'name 2', 'isFavourite':false }, }
source share