
Ask HN: Nested Resources in REST/HTTP API URLs?
by emschwartz on Hacker News.
If you’re building a REST/HTTP API, how do you think about when to express the hierarchy of resources in the URLs? For example, let’s say you had a blog site. Organizations have blogs. Blogs are made up of sections and comment threads. Comment threads have individual comments. Would you opt for: – /organizations/:organizationId/blogs/:blogId OR /blogs/:blogId (and get the organization from somewhere else like an auth token) – /organizations/:organizationId/blogs/:blogId/sections/:sectionId OR /blogs/:blogId/sections/:sectionId OR /sections/:sectionId – /organizations/:organizationId/blogs/:blogId/threads/:threadId/comments/:commentId… you get the idea
