Reputation: 19181
I know thatt those kind of URIs are good SEO wise, but are they RESTful?
My hunch is that they are not, but I am looking for verification.
The reason that I think that they are not RESTful is because the year, month and day are parameters to a query and the slug is actually the identifier.
Is blog/posts/slug?year=2011&month=9&day=19 a better approach here?
I'm not sure about this.
Upvotes: 0
Views: 444
Reputation: 700382
You should base the URL on the resource that it identifies, not on the method that you use in the back end of the server to produce the resource.
So, your scheme would work fine to identify blog posts.
The REST principle is not that much concerned with how you identify the resources, only that the verb should not be in the resource identifier, so GetBlogPost?year=2011&month=9&day=19
would be an example of an URI that is not RESTful.
Upvotes: 0
Reputation: 169411
blog/posts/year/month/day
is not a resource identifier. Not one that makes senses anyway
So what you want is something like
mysite.com/posts/<id>
Or if you want to view all posts on a certain day
mysite.com/posts?filter=2011/9/19
Upvotes: -1
Reputation: 73936
You're missing the point. You're worrying about something that REST doesn't care about. Either scheme is fine so long as the client is obtaining the URLs from hypertext and not constructing them itself according to a scheme. Please read this article about this type of misunderstanding.
Upvotes: 3