chirag
chirag

Reputation: 1828

How we can pass parameter in form of query string and access response in JSON in Servicestack

Below is service URL which return output in form of JSON.

http://localhost:8000/ByDept/ExmapleService?format=json

But I want to pass querystring parameter with this URL. Below is Service URL.

 http://localhost:8000/ByDept/ExmapleService?abc=hello&format=json

here abc=hello is parameter which is pass through query string. But using this url i am able to receive output in form of JSON.

So how we can pass parameter in form of query string and access response in json.?

Upvotes: 1

Views: 271

Answers (1)

mythz
mythz

Reputation: 143284

The Content Negotiation section in the Routing docs shows different ways you can specify the response format, e.g:

In addition you can also specify a JSON response with the Accept Request Header, e.g:

Accept: application/json

Both of the above accept extra query params without changing the Response Type:

So I don't really understand what the question is.

Upvotes: 3

Related Questions