Questions tagged [uritemplate]
80 questions
45
votes
5 answers
Optional query string parameters in URITemplate in WCF?
I'm developing some RESTful services in WCF 4.0. I've got a method as below:
[OperationContract]
[WebGet(UriTemplate = "Test?format=XML&records={records}", ResponseFormat=WebMessageFormat.Xml)]
public string TestXml(string records)
{
…

Shafique
- 1,828
- 6
- 26
- 36
42
votes
11 answers
What is the best way to design a HTTP request when somewhat complex parameters are needed?
I have some web services that I am writing and I am trying to be as RESTful as possible. I am hosting these web services using a HTTPHandler running inside of IIS/ASP.NET/SharePoint.
Most of my services expect a HTTP GET. I have two of these that…

Kirk Liemohn
- 7,733
- 9
- 46
- 57
22
votes
3 answers
Using query string parameters to disambiguate a UriTemplate match
I am using WCF 4.0 to create a REST-ful web service. What I would like to do is have different service methods called based on query string parameters in the UriTemplate.
For example, I have an API that allows users to retrieve information about a…

msplants
- 450
- 5
- 10
13
votes
3 answers
URI templates: Is there an rfc-6570 implementation in javascript?
I am using node and express. To register a controller I call:
app.get('/user/:id', function (req, res) {...});
But I would like to do it the rfc-6570 way:
app.get('/user/{id}', function (req, res) {...});
I googled just an implementation in…

afx
- 853
- 1
- 9
- 11
11
votes
2 answers
Can URI templates be used to match URIs to routes?
Frameworks like ASP.NET or Nancy provide a syntax that can be used for specifying routes, such as:
MapRoute("/customers/{id}/invoices/{invoiceId}", ...)
In ASP.NET routes work in two directions. They can match a request URI such as …

Paul Stovell
- 32,377
- 16
- 80
- 108
10
votes
4 answers
Optional path variables in Spring-MVC RequestMapping URITemplate
I have the following mapping:
@RequestMapping(value = "/{first}/**/{last}", method = RequestMethod.GET)
public String test(@PathVariable("first") String first, @PathVariable("last")
String last) {}
Which for the following…

laochan
- 101
- 1
- 1
- 4
10
votes
2 answers
Standalone Java Implementation for extracting values in URI Template (RFC 6570)?
Is there a Java standalone implementation to extract values of parameters in an URI as defined by an URI-Template (RFC 6570)?
The best implementation I've found is a ruby implementation ( https://github.com/sporkmonger/addressable )
Via…

JYC
- 343
- 3
- 8
9
votes
2 answers
Passing a class as parameter in RESTful WCF Service
In my RESTful WCF Serice I need to pass a class as a parameter for URITemplate.
I was able to pass a string or multiple strings as parameters.
But I have a lot of fields are there to pass to WCF Service.
So I have created a class and added all the…

Henry
- 847
- 6
- 24
- 53
8
votes
3 answers
Is it possible to have "overloaded" uritemplates?
[OperationContract]
[WebGet(UriTemplate = "/searchresults/{searchTerm}/{searchType}", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
Message GetSearchResults(string…

Pones
- 348
- 1
- 3
- 13
7
votes
1 answer
how to use URI templates to change path parameters in a URL in java
I followed the tutorial available in here for replacing path parameters with given values and ran the sample code which is given below
import org.glassfish.jersey.uri.UriTemplate;
import javax.ws.rs.core.UriBuilder;
import java.net.URI;
import…

Kasun Siyambalapitiya
- 3,956
- 8
- 38
- 58
6
votes
1 answer
WCF Web API UriTemplate Elements Found in Multiple Methods
Let's say I am using the new WCF Web API to build a RESTful service and, in my service, I have a section of the URI that will describe the target resource, but is used on (nearly) all methods of the contract. For example, if I have a User service…

Jim D'Angelo
- 3,952
- 3
- 25
- 39
5
votes
1 answer
Why do I get this WCF error when 'GET'ing?
I have written the method contract:
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, UriTemplate = "TestEchoWithTemplate/{message}", BodyStyle = WebMessageBodyStyle.Bare)]
string…

Exitos
- 29,230
- 38
- 123
- 178
5
votes
1 answer
WCF/Rest/UriTemplate variable length query string parameter list?
WCF will match this:
http://localhost:8888/test/blahFirst/blahSecond/sdfsdf,wwewe
to this:
[OperationContract]
[WebGet( UriTemplate = "test/{first}/{second}/{val1},{val2}" )]
string GetVal( string first, string second, string val1, string val2…

MonkeyWrench
- 1,809
- 2
- 24
- 48
5
votes
2 answers
UriTemplates with a Custom WCF 4.5 WebHttpBehavior
I'm implementing a custom WCF REST behavior, it implements/overrides the base WebHttpBehavior but allows for REST communication using a custom serializer. The code is based on Carlos' work here.
I've got it running but the thing is we REALLY want…

Brent Pabst
- 1,156
- 1
- 15
- 37
5
votes
1 answer
What support exists for uri-templates?
I think uri-templates are an extremely interesting feature for REST based applications. But appart from //put your favorite language here// based implementations I don't see any support for it in HTML itself.
It seems support for it was intended for…

Jens Schauder
- 77,657
- 34
- 181
- 348