RESTful API – Designing sub-resources

Both approaches can be considered RESTful, provided you do not break the REST constraints defined in the chapter 5 of Roy Thomas Fielding’s dissertation:

  • Client-server
  • Stateless
  • Cache
  • Uniform interface
  • Layered system
  • Code-on-demand

I cannot see major pitfalls in both approaches, but I would prefer the Approach B over the Approach A: the URLs are shorter, easier to remember and not many parameters are required.


Bonus points: Spotify and Facebook APIs follow this approach. For sure there are other APIs, but these are the ones that came up to my mind.

Leave a Comment