{"id":32370139,"url":"https://github.com/idisposable/uritemplate","last_synced_at":"2026-06-19T16:31:44.721Z","repository":{"id":141238587,"uuid":"86864998","full_name":"IDisposable/URITemplate","owner":"IDisposable","description":"The UriTemplate library is a simple set of code to encapsulate the building and parsing of URIs from replacement tokens. Using this couple of classes will make it easy to build RESTful URIs.","archived":false,"fork":false,"pushed_at":"2018-03-21T20:38:43.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T15:46:23.272Z","etag":null,"topics":["rest-api","restful","uri","uri-parser","uri-template"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IDisposable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-31T22:27:27.000Z","updated_at":"2023-09-08T17:23:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"9691aaa8-5a04-4381-9536-5c16b196fe64","html_url":"https://github.com/IDisposable/URITemplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IDisposable/URITemplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDisposable%2FURITemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDisposable%2FURITemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDisposable%2FURITemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDisposable%2FURITemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IDisposable","download_url":"https://codeload.github.com/IDisposable/URITemplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IDisposable%2FURITemplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34539678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rest-api","restful","uri","uri-parser","uri-template"],"created_at":"2025-10-24T20:03:00.445Z","updated_at":"2026-06-19T16:31:44.713Z","avatar_url":"https://github.com/IDisposable.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Project Description\nThe UriTemplate library is a simple set of code to encapsulate the building and parsing of URIs from replacement tokens. Using this couple of classes will make it easy to build RESTful URIs.\n\n## News\n[Release 1.1](https://github.com/IDisposable/URITemplate/tree/Releases/v1.1/Framework_2.0)  on 10/26/2007 to include a fix patterns with Regex meta-characters and ability to build compiled UriPatterns.\n\n## What the heck is this all about?\nUriTemplates are a simple way to codify the build of URI strings that follow web-optimization and RESTful principles. In short, you want URIs that are \"hackable\" and well formed. UriTemplates allow regular constructing and parsing through named **tokens** that specify where logical substitutions should be performed.\n\nThe idea of a UriTemplate was probably best described by Joe Gregorio in this blog posting [http://bitworking.org/news/URI_Templates](http://bitworking.org/news/URI_Templates) and it simply talks about using URIs patterns like `http://example.org/{item}/{userid}` into strings like `http://example.org/users/1234` and back, given a dictionary of token/value pairs where {{item = \"users'}} and `userid = \"1234\"`. The ability to generate well-formed URIs from the dictionary, or parse them out for incoming requests lets you easily build RESTful interfaces.\n\nThe desire to implement this came from the upcoming UriTemplate in .Net (currently somewhat released in the BizTalk Services SDK).\nThis specific implementation of the UriTemplate **does not** have all the cool features of the Microsoft version; rather it follows from a java class written by James Snell in a posting here [http://www.snellspace.com/wp/?p=467](http://www.snellspace.com/wp/?p=467). I felt his class was just perfect in the level of functionality and simplicity. This code is essentially a C# port to .Net from his java code.\n\nI expect that in a few years, .Net developers will be broadly using the System.UriTemplate currently contained in the BizTalk SDK's Microsoft.ServiceModel.Web.dll. For those of us developers in the real world not able to deploy all these cool new _pre-beta_ bits in production, this set of code will let you develop in either the 1.1 or 2.0 framework and establish the process now.\n## How to use\nHere's the simplest possible example; a console mode application that shows how to play with {{UriPattern}} to extract values for the tokens and how to use {{UriTemplate}} to generate a new URI from those token values:\n\n```C#\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nusing UriTemplate;\n\nnamespace TestJig\n{\n    public class Program\n    {\n        static void Main(string[]() args)\n        {\n            UriPattern p = UriPattern.Create(\"/{user}/{year}/{month}\");\n            IDictionary\u003cstring, string\u003e values = p.Parse(\"/marc/2007/06?no#touch\");\n            foreach (KeyValuePair\u003cstring, string\u003e item in values)\n            {\n                System.Console.WriteLine(item.Key.ToString() + \" = \" + item.Value.ToString());\n            }\n            IResolver resolver = new DictionaryResolver(values);\n            string url =  UriTemplate.UriTemplate.Expand(\"http://localhost/paystub/{year}/{month}/{user}\", resolver);\n            System.Console.WriteLine(url);\n        }\n    }\n}\n```\n## Other blog entries\nSteve Maine's  _UriTemplate 101_ talks about the System.UriTemplate class upcoming in future .Net framework releases [http://hyperthink.net/blog/2007/05/15/UriTemplate+101.aspx](http://hyperthink.net/blog/2007/05/15/UriTemplate+101.aspx)\nSteve Maine's  _UriTemplate 101_ talks about the System.UriTemplate class' Match method. [http://hyperthink.net/blog/2007/05/16/UriTemplateMatch.aspx](http://hyperthink.net/blog/2007/05/16/UriTemplateMatch.aspx)\nMark Nottingham's _URI Templating_ talks about the specification of URI templating in a broader (not just Microsoft's .Net) scope [http://www.mnot.net/blog/2006/10/04/uri_templating](http://www.mnot.net/blog/2006/10/04/uri_templating)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidisposable%2Furitemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidisposable%2Furitemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidisposable%2Furitemplate/lists"}