httpful icon indicating copy to clipboard operation
httpful copied to clipboard

Add support for URI Templates

Open nategood opened this issue 13 years ago • 1 comments

As part of the Request Template support, it would be nice to also include a URI template seeing as most requests to a URI come from the same base URI.

http://tools.ietf.org/html/draft-gregorio-uritemplate-04

nategood avatar Feb 11 '12 01:02 nategood

URI Templates provide a mechanism for abstracting a space of resource identifiers such that the variable parts can be easily identified and described. URI templates can have many uses, including discovery of available services, configuring resource mappings, defining computed links, specifying interfaces, and other forms of programmatic interaction with resources. For example, the above resources could be described by the following URI templates:

 http://example.com/~{username}/
 http://example.com/dictionary/{term:1}/{term}
 http://example.com/search{?q,lang}

We define the following terms:

  • expression - The text between '{' and '}', including the enclosing braces, as defined in Section 2.
  • expansion - The string result obtained from a template expression after processing it according to its expression type, list of variable names, and value modifiers, as defined in Section 3.
  • template processor - A program or library that, given a URI Template and a set of variables with values, transforms the template string into a URI-reference by parsing the template for expressions and substituting each one with its corresponding expansion.

nategood avatar Mar 06 '12 05:03 nategood