Suppose I have a weblog application with RESTful resources accessible
at the following URLs:
GET /posts
GET /posts/1
GET /categories/
GET /categories/1
GET /categories/1/posts
As implemented the semantics of /posts and /categories/1/posts are
such that they show “current” posts, with current defined to be a
rolling window of a certain duration.
My question is this: what do you think is the best way to represent
the archives of older posts as RESTful resources?
We could do this:
GET /posts/archives
GET /categories/1/posts/archives
or this:
GET /archives/posts
GET /archives/categories/1/posts
or this:
GET /archived_posts/
GET /categories/1/archived_posts
or, undoubtedly, others. What do you think is the most defensible
approach?
Note: if you don’t like the idea of having GET /posts return only
“current” posts then you can perfectly well invert my question. Let
GET /posts retrieve the full set of all posts known to the system.
What then is a good RESTful representation that limits results to
“current” posts?
Thanks in advance for your thoughts,
Sven