URI Template — RFC6570
Implementations — JS, Python.
Common test suite.
var template1 = UriTemplate("/date/{colour}/{shape}/");
var template2 = UriTemplate("/prefix/{?params*}");
var template3 = UriTemplate("{/id*}{?fields,token}");
template1.fillFromObject({colour: "green", shape: "round"});
// "/categories/green/round/"
template2.fillFromObject({
params: {a: "A", b: "B", c: "C"}
});
// "/prefix/?a=A&b=B&c=C
template3.fromUri("/person/albums?fields=id,name,picture&token=12345");
/*
{
id: ["person", "albums"],
fields: ["id", "name", "picture"],
token: "12345"
}
*/