Forum: Ruby on Rails Theory/opinion question: What are good RESTful archive URLs?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sven (Guest)
on 2009-01-13 03:31
(Received via mailing list)
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
Jeffrey L. Taylor (Guest)
on 2009-01-13 23:37
(Received via mailing list)
Quoting S. <removed_email_address@domain.invalid>:
> 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.
>

GET /posts/1.html  # "current" posts
GET /posts/1.xml  # all posts

The former is presumably a browser with a human in front of it.  The
latter is
another app that can define "current" for itself it it wants.  Same
applies to
other non-human readable formats, e.g., json.

Just my $0.02USD,
  Jeffrey
This topic is locked and can not be replied to.