Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To sum up all the discussion in the comments, and not to change my initial proposal, this is what I'd come up finally:</p> <p>You want to access images via tags; each tag relates to a set of images. As a given tag may be used a lot more than another (say, New York photos used a lot more than Chicago's), you should use a RESTful configuration that allows caching, so you can cache New York photos. IMHO, the solution would be:</p> <ul> <li><p>Each image has a fixed URI:</p> <pre><code>http://www.example.com/images/12345 </code></pre></li> <li><p>Each tag has also a URI:</p> <pre><code>http://www.example.com/tags/New_York/random </code></pre> <p>This URI acts as a random dispatcher of images on the set; it returns a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4" rel="nofollow noreferrer">303 See Other</a> response, redirecting to a random image of the set. <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4" rel="nofollow noreferrer">By definition</a>, this URI must not be cached, and the fixed one should, and the browser shouldn't understand that the redirection to the second resource is permanent, so it's optimal.</p></li> <li><p>You could even access the whole set via:</p> <pre><code>http://www.example.com/tags/New_York </code></pre> <p>This access would result in a <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.1" rel="nofollow noreferrer">300 Multiple Choices</a> response; it returns the whole set (as URIs, not as images!) to the browser, and the browser decides what to do with it.</p></li> <li><p>You can also use intersection of various tags:</p> <pre><code>http://www.example.com/tags/New_York/Autumn/Manhattan/random http://www.example.com/tags/Autumn/Manhattan/New_York/random (equivalent to the previous one) http://www.example.com/tags/New_York/girls/Summer/random etc. </code></pre></li> </ul> <p>So you have a fixed URI for each image, a fixed URI for each tag and its related set of photos, and a fixed URI for a random dispatcher that each tag has. You haven't need to use any GET parameters as other potential solutions, so this is as RESTful as you can get.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload