<?xml version="1.0"?>
<?xml-stylesheet href="/transform" type="text/xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:bs="http://purl.org/ontology/bibo/status/" xmlns:ci="https://vocab.methodandstructure.com/content-inventory#" xmlns:dct="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xhv="http://www.w3.org/1999/xhtml/vocab#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" lang="en" prefix="bibo: http://purl.org/ontology/bibo/ bs: http://purl.org/ontology/bibo/status/ ci: https://vocab.methodandstructure.com/content-inventory# dct: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/ rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# xhv: http://www.w3.org/1999/xhtml/vocab# xsd: http://www.w3.org/2001/XMLSchema#" vocab="http://www.w3.org/1999/xhtml/vocab#" xml:lang="en">
  <head>
    <title property="dct:title">URI Path and Query Parameter Semantics</title>
    <base href="https://doriantaylor.com/policy/uri-path-and-query-parameter-semantics"/>
    <link href="../document-stats#EwnhMyFg0ydpsdVzXuv9nL" rev="ci:document"/>
    <link href="../elsewhere" rel="alternate bookmark" title="Elsewhere"/>
    <link href="../this-site" rel="alternate index" title="This Site"/>
    <link href="http://purl.org/ontology/bibo/status/draft" rel="bibo:status"/>
    <link href="http://purl.org/ontology/bibo/status/published" rel="bibo:status"/>
    <link href="" rel="ci:canonical" title="URI Path and Query Parameter Semantics"/>
    <link href="../lexicon/#EzqXIsriaILFcWjXdS7FbI" rel="dct:audience" title="Software Developer"/>
    <link href="../person/dorian-taylor#me" rel="dct:creator" title="Dorian Taylor"/>
    <link href="distinguishing-resources-from-files" rel="dct:references next" title="Distinguishing Resources from Files"/>
    <link href="uri-syntax-constraints" rel="dct:references prev" title="URI Syntax Constraints"/>
    <link href="uris-resources-and-representations" rel="dct:references up" title="URIs, Resources and Representations"/>
    <link href="../person/dorian-taylor" rel="meta" title="Who I Am"/>
    <link about="../" href="../3f36c30c-6096-454a-8a22-c062100ae41f" rel="alternate" type="application/atom+xml"/>
    <link about="../" href="../f07f5044-01bc-472d-9079-9b07771b731c" rel="alternate" type="application/atom+xml"/>
    <link about="../" href="../this-site" rel="alternate"/>
    <link about="../" href="../elsewhere" rel="alternate"/>
    <link about="../" href="../e341ca62-0387-4cea-b69a-cdabc7656871" rel="alternate" type="application/atom+xml"/>
    <link about="../verso/" href="../3f36c30c-6096-454a-8a22-c062100ae41f" rel="alternate" type="application/atom+xml"/>
    <link about="../verso/" href="../this-site" rel="alternate"/>
    <link about="../verso/" href="../elsewhere" rel="alternate"/>
    <meta content="uri-path-and-query-parameter-semantics" datatype="xsd:token" property="ci:canonical-slug"/>
    <meta content="Policy guidelines for how URI parameters in both the path (underutilized) and query components ought to be interpreted." name="description" property="dct:abstract"/>
    <meta content="2008-07-24T20:51:04+00:00" datatype="xsd:dateTime" property="dct:created"/>
    <meta content="uri-path-and-query-parameter-semantics" property="dct:identifier"/>
    <meta content="2008-09-01T04:29:32+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2008-09-16T08:11:07+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2008-10-09T02:02:01+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2009-03-04T00:43:00+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2009-03-19T19:05:12+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2009-03-20T16:49:22+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2009-03-20T18:02:32+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2011-06-03T07:51:31+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2022-05-31T04:18:52+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta content="2022-05-31T15:10:50+00:00" datatype="xsd:dateTime" property="dct:modified"/>
    <meta about="../person/dorian-taylor#me" content="Dorian Taylor" name="author" property="foaf:name"/>
    <meta content="summary" name="twitter:card"/>
    <meta content="@doriantaylor" name="twitter:site"/>
    <meta content="URI Path and Query Parameter Semantics" name="twitter:title"/>
    <meta content="Policy guidelines for how URI parameters in both the path (underutilized) and query components ought to be interpreted." name="twitter:description"/>
    <object>
      <nav>
        <ul>
          <li>
            <a href="../defining-feeds" rev="dct:references" typeof="bibo:Article">
              <span property="dct:title">Defining Feeds</span>
            </a>
          </li>
          <li>
            <a href="distinguishing-resources-from-files" rev="dct:references" typeof="bibo:Report">
              <span property="dct:title">Distinguishing Resources from Files</span>
            </a>
          </li>
          <li>
            <a href="http-url-path-parameter-syntax" rev="dct:references" typeof="bibo:Report">
              <span property="dct:title">HTTP URL Path Parameter Syntax</span>
            </a>
          </li>
          <li>
            <a href="the-uri-naming-conundrum" rev="dct:references" typeof="bibo:Report">
              <span property="dct:title">The URI Naming Conundrum</span>
            </a>
          </li>
          <li>
            <a href="uri-syntax-constraints" rev="dct:references" typeof="bibo:Report">
              <span property="dct:title">URI Syntax Constraints</span>
            </a>
          </li>
          <li>
            <a href="uris-resources-and-representations" rev="dct:references" typeof="bibo:Report">
              <span property="dct:title">URIs, Resources and Representations</span>
            </a>
          </li>
          <li>
            <a href="../document-stats#EwnhMyFg0ydpsdVzXuv9nL" rev="ci:document" typeof="qb:Observation">
              <span>urn:uuid:c2784cc8-5834-4c9d-ba6c-755cd7baff67</span>
            </a>
          </li>
        </ul>
      </nav>
    </object>
  </head>
  <body about="" id="EwtnwDAW3dhlJbVqlsKnBL" typeof="bibo:Article">
    <p>On the most common <abbr title="World-Wide Web">Web</abbr> server configurations, the path of a <acronym title="Uniform Resource Locator">URL</acronym> pointing to a given site maps directly to a space on its file system. The mapping is one-to-one, effectively rendering <acronym title="Hypertext Transfer Protocol">HTTP</acronym> <a href="../lexicon/resource" title="Resource" rel="dct:references">resources</a> semantically equivalent to <a href="../lexicon/file" title="File" rel="dct:references">files</a>.</p>
    <p>In reality, an <acronym title="Hypertext Transfer Protocol">HTTP</acronym> resource can exhibit many more dimensions than a file. Given the right infrastructure, a <abbr title="World-Wide Web">Web</abbr> server can deliver many possible <a rel="dct:references xhv:glossary" href="../lexicon/representation" title="Representation">representations</a> for a given resource, or even <em>permute</em> a resource on the fly. A common method of manipulating dynamic <acronym title="Hypertext Transfer Protocol">HTTP</acronym> resources is through an essential part of the <abbr title="World-Wide Web">Web</abbr>'s interface: the <acronym title="Uniform Resource Identifier">URI</acronym>.</p>
    <p>This section proposes a manner of normalizing the effects on resources that can be manipulated through the <acronym title="Uniform Resource Identifier">URI</acronym> path and query parameters.</p>
    <section class="in-progress" id="uuid-be608af0-948b-4bbc-a0d3-f09f48da06c8">
      <h2>Path Parameters</h2>
      <p>In progress</p>
    </section>
    <section id="uuid-5a0a63bd-e1da-47ed-8124-40a6ec1b01a7">
      <h2>Query Strings</h2>
      <p>A query string is <a href="http://tools.ietf.org/html/rfc3986#section-3.4" title="RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax" rel="dct:references">defined as a non-hierarchical component</a> of a <acronym title="Uniform Resource Identifier">URI</acronym>. <a href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html" title="The Common Gateway Interface Specification" rel="dct:references">The <acronym title="Common Gateway Interface">CGI</acronym> specification</a>, the conventions of which most <abbr title="World-Wide Web">Web</abbr> applications inherit, <a href="http://hoohoo.ncsa.uiuc.edu/cgi/cl.html" title="CGI Command line options" rel="dct:references">further defines it</a> as either a list of parameters separated by the <samp title="plus">+</samp> character or a bag of key-value pairs joined by <samp title="equals">=</samp> and delineated by either <samp title="ampersand">&amp;</samp> or <samp title="semicolon">;</samp> &#x2014; but not both the list and bag at once.</p>
      <p>The parameter-list form of the query string <samp>?one+two+three</samp> was intended to pass directly into the command line of a <acronym title="Common Gateway Interface">CGI</acronym> program. When the <samp title="equals">=</samp> character was present, the <abbr title="World-Wide Web">Web</abbr> server's <acronym title="Common Gateway Interface">CGI</acronym> implementation would instead place the unaltered query string in the <samp>QUERY_STRING</samp> environment variable and leave the command-line list empty.</p>
      <aside role="note" id="E4SCAeLi7bOEAXkFnhieSJ">
        <p>It is worth noting that <acronym title="Common Gateway Interface">CGI</acronym> libraries such as the venerable <a href="http://search.cpan.org/~lds/CGI.pm-3.42/" title="Lincoln D. Stein / CGI.pm-3.42 - search.cpan.org" rel="dct:references">Perl implementation</a> conflate the contents of the query string with content <samp>POST</samp>ed from <acronym title="Hypertext Markup Language">HTML</acronym> forms. This clearly innocent appeal to expedience has been propagated forward to ubiquitous products like <acronym title="I'm not sure what they're expanding PHP to these days">PHP</acronym>, eroding <a href="http-method-idempotence-and-referential-transparency" rel="dct:references" title="HTTP Method Idempotence and Referential Transparency">the idempotence of the <samp>GET</samp> <acronym title="Hypertext Transfer Protocol">HTTP</acronym> method</a> and confusing an entire generation of <abbr title="World-Wide Web">Web</abbr> developers.</p>
      </aside>
      <section id="ER6Q7bLenH6vnxO4vMYUoK">
        <p><strong>in progress, march 20 2009</strong></p>
        <p>The query component can depict a <em>dictionary</em> with textual <em>keys</em>. Since the the key-value pairs can be repeated, e.g. <samp>?one=1&amp;two=2&amp;three=3&amp;one=uno</samp>, each entry in the dictionary corresponds to a <em>bag</em> of values. If we <span class="parenthesis" title="which is not recommended; URIs go through hell and back">respect the order of the query string</span>, we get a <em>sequence</em>. If we prune duplicate values, we get a <em>set</em> or <em>ordered set</em>, respectively.</p>
        <p>The purpose of the query component is to <em>focus</em> some aspect of the resource. By adding key-value data, you're saying you want some property of the resource to permute according to a certain value.</p>
        <p>This dictionary can then be applied to various slots that take a dictionary-shaped object. This is nothing remarkable; virtually every <abbr title="World-Wide Web">Web</abbr> application framework does it. What <em>is</em> remarkable, however, is where the dictionary is <em>constructed</em>.</p>
      </section>
      <p>The semantics of the <span class="parenthesis" title="?one+two+three">sequential form</span> of the <acronym title="Uniform Resource Identifier">URI</acronym> query component are <a href="semantics-of-uri-path-parameters" title="Semantics of URI Path Parameters" rel="dct:references">addressed more robustly elsewhere</a>, and as such this form can probably be safely discarded in non-<acronym title="Common Gateway Interface">CGI</acronym> <abbr title="World-Wide Web">Web</abbr> applications to mitigate confusion.</p>
    </section>
  </body>
</html>
