URI Templates

URI Templates are really pretty interesting – the idea is to have a spec for defining how URIs for accessing a Web resource should be made up. This quote from the spec (which is a nice and short one, as specs should) explains it:

Given the following URI Template:

http://www.example.com/users/{userid}

And the following variable value

userid := fred

The expansion of the URI Template is:

http://www.example.com/users/fred

Get it? This is pretty sweet – a human/machine readable standard for URI access to Web apps etc. The spec defines a few more syntax rules and there’s a parser/”explainer” in Joe Gregorio‘s (URI Template’s inventor) site, but in all it’s pretty simple.

Like many simple things, it could go far, being so easy to use. Maybe become a standard grammar for Web requests, similar to XML’s standard grammar for responses. It could be used in Web service libraries, docs and maybe even a “mod_rewrite for people who have lives outside mod_rewrite” someday. Could turn into DTD, though, so I guess time and adoption will tell.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s