
URI Template - soheilpro
http://tools.ietf.org/html/rfc6570
======
buro9
This is one of two proposed standards I've been following with some interest,
the other being a sane(ish) way to implement PATCH for JSON objects:

<http://tools.ietf.org/html/rfc6902>

------
nicwolff
There's a mature Perl module for this as well:
[http://search.cpan.org/~bricas/URI-
Template-0.17/lib/URI/Tem...](http://search.cpan.org/~bricas/URI-
Template-0.17/lib/URI/Template.pm)

------
zimbatm
For rubyists, the addressable gem has support for it:
[https://github.com/sporkmonger/addressable/tree/#uri-
templat...](https://github.com/sporkmonger/addressable/tree/#uri-templates)

~~~
soheilpro
And for Node.js: <https://github.com/bramstein/url-template>

------
spankalee
It's pretty great to have a standard for templates to generate URIs, but it's
equally important to parse URIs and extract the variables. It looks like this
RFC skimps on that part:

In Section 1.4:

    
    
        Some URI Templates can be used in reverse for the purpose of variable
        matching: comparing the template to a fully formed URI in order to
        extract the variable parts from that URI and assign them to the named
        variables.  Variable matching only works well if the template
        expressions are delimited by the beginning or end of the URI or by
        characters that cannot be part of the expansion, such as reserved
        characters surrounding a simple string expression.  In general,
        regular expression languages are better suited for variable matching.
    

It'd be better IMO to have a stricter definition of parseable templates and
include test cases so that implementations that try to validate templates for
parseability don't disagree.

------
zacharyvoase
I wonder if it'd be worth implementing this in my URLObject library
(<https://github.com/zacharyvoase/urlobject>).

------
vy8vWJlco
Slightly related (if you hold your head at the right angle) is the
(commercial) platform called NetKernel. It brings URIs into conventional
programming scenarios, presenting something like a RESTful programming
language. (Whatever that might mean...)

I haven't done anything with it, but I find it fascinating just to read the
documentation:

[http://docs.netkernel.org/book/view/book:quickstart/doc:quic...](http://docs.netkernel.org/book/view/book:quickstart/doc:quickstart:title)

------
steveklabnik
GitHub uses URI templates extensively: <https://api.github.com/>

------
specialist
Very helpful, thanks for link. I'm working on my own web app "framework" and
had rolled my own URL/URI router. This will reduce my reinvention quotient.

------
alanho
Ruby Gems for this <https://github.com/sporkmonger/addressable>

------
ubersoldat2k7
Why do RFC's have to be so ugly?

~~~
treerex
Because they originate from a time where plain text was what you had, and the
format was created to be consistent and easy to format by hand. I still prefer
my specifications to be in plain text so that I can view them easily and
quickly.

~~~
jrochkind1
It would be easy enough to at least format them in HTML, they use such
consistent ascii 'typesetting', it could easily be automated.

I mean, they are formatted in HTML now, but as a giant block of monospace
text. They could use <hx>s for the headers, let the text flow with browser
resize for small screens, heck use bootstrap for good readable web
typesetting, etc.

I am not sure why the IETF isn't interested in better web typesetting for em.

At one point someone had a site that did that, I think it was advertised and
discussed here on HN, but I forget what it was called, and I think it faded
into non-supported obscurity (since it was obviously a labor of love, unpaid).

