Monday, February 7, 2011

Named parameters in a URL

Bill Brown was showing me his NLP links in Pinboard when I noticed that he was typing named parameters in the pinboard URL. I'm intimately familiar with named parameters which have been around for a long time in computer languages and have recently been introduced into C# and am a big fan of them. However, I have never seen them used (or thought of using them) in a URL before, here is an example:

In this URL we're saying find user (key=u, value=bbrown) named bbrown and all items that he's tagged (key=t) with both python and nlp. If we swapped the tags around the query produces the same results:

All is not perfect, however, in Utopia. If you swap the user param to after the tag param it won't work. This link takes you to a broken page:

This is fairly easy to fix and I'm guessing that the guys at don't think that many people will be hacking their url's and so didn't put the time into making them work in any order like true named parameters would.

It's still great to such innovation in the use of the url without using the query param which would have achieved the same result. Out of curiosity I tried:

but that doesn't translate for them.


  1. Why would you want to do this? Maybe live debugging? Seems kind of overly transparent when it comes to security and users.

  2. If you want a perma-link that does not include query params then this would be a solution. The objective is to create a url that is intentionally hackable (hack in the sense that you can change the params - not the bad type of hack) so that users can quickly navigate the site through editing the url.