Creating URIs

Topics: Web Api
Sep 24, 2011 at 3:31 AM

Was there anything added to Preview 5 to make creating and managing resource URIs easier when implementing a RESTful solution?



Sep 25, 2011 at 4:24 PM
Edited Sep 25, 2011 at 4:29 PM

I agree. It would be a very nice thing to support some built-in designer (grid) for editing URI templates.

Service Contract Method Params  Return Type URL Route Web method
Contacts GetContact int id
string name
Contact /?id={id} GET
Contacts CreateContact Contact contact Contact /create POST

And of course, all values are modifiable. (refactoring)

Sep 27, 2011 at 7:24 AM

malevy, when you say managing uris easier, do you mean providing a service that makes it easier to generate uris for self links / other resources? Can you elaborate on what you are looking for exactly?

Sep 29, 2011 at 12:21 PM

Hi Glenn. Sorry for the delay in getting back to you.

To answer your question, yes, I would appreciate some facility to assist with the creation of Uri's for self links and other rel's that I need to include within a representation of a resource.

Currently there are parts of the Uri scattered across the service. The baseUri is part of the site config. The base for the resource is in the route. There is also the UriTemplate which may or may not contain a component of a uri that I need to return.

Currently I have an OperationHandler that collects a portion of this (the base from the site and the portion from the resource) and exposes it as a parameter. That solves a large part of the problem.