{"id":84,"date":"2009-06-16T09:36:00","date_gmt":"2009-06-16T09:36:00","guid":{"rendered":"https:\/\/wdev-blog.azurewebsites.net\/index.php\/2009\/06\/16\/using-uritemplate\/"},"modified":"2009-06-16T09:36:00","modified_gmt":"2009-06-16T09:36:00","slug":"using-uritemplate","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2009\/06\/16\/using-uritemplate\/","title":{"rendered":"using UriTemplate"},"content":{"rendered":"<p>Copied from <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd203052.aspx\">MSDN<\/a>:<\/p>\n<p>The UriTemplateTable class provides a mechanism for managing a collection of UriTemplate objects. This makes it easy to call Match on the table to find all templates that match the supplied Uri. Alternatively, you can call MatchSingle to ensure it matches only a single UriTemplate in the table. <code><\/p>\n<p>Uri baseUri = new Uri(\"http:\/\/contoso.com\/bookmarkservice\");<br \/>UriTemplate uriTemplate = new UriTemplate( \"users\/{username}\/bookmarks\/{id}\");<\/p>\n<p>\/\/ generate a new bookmark URI<br \/>Uri newBookmarkUri = uriTemplate.BindByPosition(baseUri, \"skonnard\", \"123\");<\/p>\n<p>\/\/ match an existing bookmark URI<br \/>UriTemplateMatch match = uriTemplate.Match(baseUri, newBookmarkUri);<br \/>System.Diagnostics.Debug.Assert(match != null);<br \/>Console.WriteLine(match.BoundVariables[\"username\"]);<br \/>Console.WriteLine(match.BoundVariables[\"id\"]);<br \/><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Copied from MSDN: The UriTemplateTable class provides a mechanism for managing a collection of UriTemplate objects. This makes it easy to call Match on the table to find all templates that match the supplied Uri. Alternatively, you can call MatchSingle to ensure it matches only a single UriTemplate in the table. Uri baseUri = new &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2009\/06\/16\/using-uritemplate\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;using UriTemplate&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[74,20],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"Copied from MSDN: The UriTemplateTable class provides a mechanism for managing a collection of UriTemplate objects. This makes it easy to call Match on the table to find all templates that match the supplied Uri. Alternatively, you can call MatchSingle to ensure it matches only a single UriTemplate in the table. Uri baseUri = new&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/84"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":0,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}