1

What if http://example.com/foo and http://example.com/bar both represent the same resource and the server does not distinguish between the two? What if it uses them interchangeably within documents that form the engine of application state (following HATEOAS), so that it displays /bar in some contexts and /foo in others?

Is this RESTful?

One potential benefit of this is to attach descriptors to URIs, e.g. http://example.com/article/30204/The-Quick-Brown-Fox, for the sake of bookmarks, search engine queries, and in general the potential for people to recognize a URI just by looking at it.

Jordan
  • 4,510
  • 7
  • 34
  • 42
  • Look at how SO handles URLs .. (up there, in the title bar). But it doesn't mix "question" with "profile", however. –  Aug 01 '12 at 02:25
  • Define RESTful. Look at in context of a GET. What is your conclusion? –  Aug 01 '12 at 02:27
  • 1
    See my answer to this question: http://stackoverflow.com/questions/11104466/restful-url-to-get-resource-by-different-fields/ – Brian Kelly Aug 01 '12 at 03:15

1 Answers1

2

It is perfectly acceptable from a REST point of view for a resource to have multiple URIs, so long as those URIs are discovered by following hypermedia controls from the application's published entry point. However, I would recommend against doing so. Having multiple URIs means that some cache hits will now be misses and you can potentially confuse people as it will not be clear if the two URIs lead to the same resource or two different resources that are very similar.

Tom Howard
  • 6,516
  • 35
  • 58