RejectedSoftware Forums

Sign up

Access unbound query parameters in REST API

Hello everybody,

is it possible to access the query parameters that weren't bound to any parameters of a REST method, without using @before?

I'm thinking of something like this:

@queryParam("foo", "foo)
void aMethod(string foo, string[string] params)
{
    writeln("foo is ", foo);
    writeln("params is ", params);
}

With a URL like this:

/aMethod?foo=bar&a=4&b7

Would result in the function printing the following:

foo is bar
params is ["a":"4", "b":"7"]

Thanks,
Zdeněk

Re: Access unbound query parameters in REST API

On Sun, 31 May 2015 23:29:00 GMT, Zdeněk wrote:

Hello everybody,

is it possible to access the query parameters that weren't bound to any parameters of a REST method, without using @before?

I'm thinking of something like this:

@queryParam("foo", "foo)
void aMethod(string foo, string[string] params)
{
    writeln("foo is ", foo);
    writeln("params is ", params);
}

With a URL like this:

/aMethod?foo=bar&a=4&b7

Would result in the function printing the following:

foo is bar
params is ["a":"4", "b":"7"]

Thanks,
Zdeněk

Short answer: no (ATM)
I didn't think about this use case. Could you expand on why you need it ?

Re: Access unbound query parameters in REST API

On Tue, 02 Jun 2015 23:45:11 GMT, Mathias LANG wrote:

Short answer: no (ATM)
I didn't think about this use case. Could you expand on why you need it ?

This is unfortunately mandated by an already existing API specification which I'm currently implementing.

In this case the call is used to retrieve information about a product from a database, which might require certain parameters. What these parameters mean and how they're named is entirely dynamic and it's basically just a string[string] without any meaning to the API.

Re: Access unbound query parameters in REST API

On Wed, 03 Jun 2015 21:29:25 GMT, Zdeněk wrote:

On Tue, 02 Jun 2015 23:45:11 GMT, Mathias LANG wrote:

Short answer: no (ATM)
I didn't think about this use case. Could you expand on why you need it ?

This is unfortunately mandated by an already existing API specification which I'm currently implementing.

In this case the call is used to retrieve information about a product from a database, which might require certain parameters. What these parameters mean and how they're named is entirely dynamic and it's basically just a string[string] without any meaning to the API.

Then I'm afraid the REST interface isn't up to the task at the moment.
It has been build in order to provide the safety that client and server will be able to communicate, and dynamic use cases as this one are not covered.

Re: Access unbound query parameters in REST API

Am 04.06.2015 um 22:14 schrieb Mathias LANG:

On Wed, 03 Jun 2015 21:29:25 GMT, Zdeněk wrote:

On Tue, 02 Jun 2015 23:45:11 GMT, Mathias LANG wrote:

Short answer: no (ATM)
I didn't think about this use case. Could you expand on why you need it ?

This is unfortunately mandated by an already existing API specification which I'm currently implementing.

In this case the call is used to retrieve information about a product from a database, which might require certain parameters. What these parameters mean and how they're named is entirely dynamic and it's basically just a string[string] without any meaning to the API.

Then I'm afraid the REST interface isn't up to the task at the moment.
It has been build in order to provide the safety that client and server will be able to communicate, and dynamic use cases as this one are not covered.

Well, there is @before and @after to solve this, even if they are
not the prettiest solution.