Loading ...
Sorry, an error occurred while loading the content.

5568Re: [rest-discuss] Correct REST principles

Expand Messages
  • Christian Jensen
    Dec 1, 2005
    • 0 Attachment
      After a good nights rest :) I have a slightly better thought set - no query strings.

      A query string seems to be a way to normalize a response, meaning: to take out the hierarchical ordering of the URL

      The following makes sense: http://[host]//[universe]/[galaxy]/[system]/[planet] but then what do you do with the latitude and longitude?

      It is a toss up:

      Either works, but which one is correct? They are both equally ranked and are not at all hierarchical.

      Using a query string paradigm you would simple add ?latitude=90.0&longitude=12.0

      But I propose the following: http://[host]///[universe]/[galaxy]/[system]/[planet]/90.0%2012.0

      I am considering using a space (%20) because it is easily parsed. I am using latitude first because that is how we say it in natural language. So what happens if you need to do an actual query string - how would you RESTify Google search page? ../query/my%20search seems totally broken and really does not describe what the URL is... I will do more thinking on this - anyone have an answer?

      This brings up 2 additional points: what is this URLs type - I am an advocate of having the HTTP mime type specified as the data is retrieved (as opposed to the file extension dictating the mime). The second point is something that I have always had a pet peeve about - the trailing slash - a URL should never have a trailing slash. If there is a trailing slash, the inference is made by the web server - index.html, index.php, default.aspx - whatever - this in my opinion is faulty - a URL should say what it means and mean what it says. Am I among like believers?

      In my example, I never indicated with the URL exactly the classification of the service (with a /photos/ or a /heightmaps/ etc.). Personally, I feel that a URL should be self discovering, that is to says that if I were to trim down the URL down to just http://[host]///[universe]/[galaxy]/[system]/[planet] the data would be something that allows me to further progress, my initial proposition is to use RDF for this. So in this example, the RDF would shoot back a list of URLs that are under this one and describe them.

      Thoughts? Am I on the right path?

      Costello, Roger L. wrote:
      > 1. Is it considered bad taste to use parameters (i.e. ?id=1) within the
      > URL? From what I have read it is but everyone seems to be doing it.

      This is an excellent question, and has also been a question on my mind of late.
      My thinking is this: The sole purpose of a URL is to "identify" a resource. 
      Tim Berners-Lee Axiom 0: every resource on the Web shall be uniquely identified by a URL.
      For example, this (logical URL) identifies a 747 aircraft resource:
      If we agree that the sole purpose of a URL is to identify a resource, then I cannot see why a person would ever use query strings.  If information needs to be passed to the resource, then you must ask "why?"  Are you wishing to update a resource?  If so, then you should POST the information to the resource (and the resource is identified using a logical URL without any query strings).
      I am eager to hear what others are thinking on this topic.  /Roger
    • Show all 11 messages in this topic