I feel a bit absurd asking this but I can't find a way to get parameters for a get request at
/api/foo?sort=name
for instance.
In the ApiController
class, I gave a public string Get()
. Putting Get(string sort)
makes /api/foo
a bad request. Request instance in the ApiController
is of type System.Net.Http.HttpRequestMessage
. It doesn't have a QueryString
or Parameters
property or anything.
You could just use
HttpContext.Current.Request.QueryString