# Theory/opinion question: What are good RESTful archive URLs?

**URL:** <https://www.ruby-forum.com/t/theory-opinion-question-what-are-good-restful-archive-urls/157552>\
**Category:** Rails\
**Created:** [January 13, 2009, 2:31am UTC](https://www.ruby-forum.com/t/theory-opinion-question-what-are-good-restful-archive-urls/157552 "2009-01-13T02:31:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@sven](https://www.ruby-forum.com/u/sven)\
**Post date:** [January 13, 2009, 2:31am UTC](https://www.ruby-forum.com/t/theory-opinion-question-what-are-good-restful-archive-urls/157552/1 "2009-01-13T02:31:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sven](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e47c2d/32.png) [@sven](https://www.ruby-forum.com/u/sven)\
**Post date:** [January 13, 2009, 10:37pm UTC](https://www.ruby-forum.com/t/theory-opinion-question-what-are-good-restful-archive-urls/157552/2 "2009-01-13T22:37:32Z")

</div>

Quoting S. [removed\_email\_address@domain.invalid](mailto: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
