2

Fielding writes in his famous dissertation (p.89)

The only thing that is required to be static for a resource is the semantics of the mapping, since the semantics is what distinguishes one resource from another.

So a resource prot://bookstore.com/new-books-this-week is OK, because although it will always show different books every week, the semantic meaning does not change.

I don't understand how this could be otherwise, unless the above URI starts returning new books from last week or, say, authors instead of books.

Is there a commonly occurring URI pattern in the real world that violates this principle?

  • I think your "better counterexample" is wrong: in that example, the semantic meaning stays the same, but the URI changes, no? This is the dual problem to what you are looking for, which is the URI stays the same, but the semantic meaning changes. – Jörg W Mittag Dec 11 '17 at 4:02
  • @JörgWMittag: Page 89 of Fielding's dissertation (referenced by the OP) seems to be discussing URL breakage or resource changes. One of the examples given is that of "the author's preferred version of a resource." The semantics would break if (1) the URL changes, or (2) the URL stays the same but it no longer points to the author's preferred version of a resource. Note that the document itself can change without breaking the semantics, so long as it is still the author's preferred version. – Robert Harvey Dec 11 '17 at 4:07
  • 1
  • @gnat: I don't think this applies, because I am rather looking for "proof by counterexample". I don't want people to post endless lists of examples. One demonstrative example would illustrate the requirement made by fielding and thus answer a specific question. – problemofficer Dec 12 '17 at 18:07
  • 2
    One URI style that is common yet holds no useful semantics is pagination, e.g. in a blog: http://example.com/posts/2. Whereas /posts reasonably holds the newest posts, the meaning of /posts/2 is far less useful as it's just the overflow from the previous page. This is very fun when a new item is inserted while you're navigating the pagination, which can lead to missed/double items. A serious API would paginate by object ID or timestamp, not with a relative cursor. – amon Jan 18 '18 at 16:26
2

Fielding's dissertation was based on looking at the design principles that make the web work well and this is one of the things that, at a high level, most websites get right. If you did something like create sequential pages e.g. /foo/bar/0, /foo/bar/1 and then reassigned them randomly then that would violate this but I doubt anyone does this, at least not for purposefully or for very long. I propose the reason for that is because URI stability is so fundamental to making things work and Fielding is simply recognizing this.

The only thing that I can think of that I've seen on a regular basis is a website reorganizing all their URIs such that old links to them return 404. It's not that the pages are no longer available (a.k.a 410: GONE), they just dropped the old URLs without forwarding. A big blue company did this with their online documentation about a decade or so ago. I would regularly find a thread related to a problem we were having and someone posting a response like "the solution can be found here" with a link that just gives a 404. Thankfully, I no longer have to care. Fielding is right, this is intolerable.

While this might fall into a different category of problems, I argue that it is an example of this because an existing URI's semantic meaning has changed from something to nothing.

| improve this answer | |
0

Is there a commonly occurring URI pattern in the real world that violates this principle?

Not one that is RESTful, per the definition of REST.

There are billions of cases where a URL's response has changed meaning and caught the consumers of that endpoint off-guard. But that's just a failure of the provider to effectively communicate the semantic meaning of the resource (which is often “This resource represents whatever we feel like it representing and we make no guarantees about its availability”), or an inability of the client to comprehend the level of ineptitude of the provider in avoiding deleting its own website/going bust/tripping over a power cable.

e.g. any web page that used to work but now returns an error page with a 200 response (and not even a 404, let alone a 410).

Doing REST properly (as a provider) boils down to:

  1. Communicating effectively about the meanings of resources
  2. Using your communication protocol (usually HTTP but not necessarily) properly
| improve this answer | |
  • Unfortunately, I don't see this answer answering my specific question. You are not providing an example of a common pattern except that the pages are not available at all. Although a mismatching status code is relevant, it is not part of the URI. This is why I have downvoted this answer. – problemofficer Dec 18 '17 at 18:53
  • I answered the question in the first line. No, there is not a common pattern that satisfies your criteria, therefore an example cannot be provided. What are you wanting to do anyway? – Nicholas Shanks Dec 19 '17 at 11:40
  • Can you show (prove) why it is the case then, please? A one-sentence statement does not convince me. And with that the rest of your answer becomes irrelevant, because this is not what I was asking. At least it seems to me this way. – problemofficer Dec 19 '17 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.