Using HttpClient to Send Dates in URL Using AttributeRouting

后端 未结 2 1270
醉话见心
醉话见心 2021-01-18 22:16

I\'m having some problems getting a date range query accepted by my WebAPI. As as far as I can tell from everything I\'ve read this should be working but I still get

2条回答
  •  旧时难觅i
    2021-01-18 22:42

    : is a reserved character in the URL but it's acceptable in a query string. So if it works for your routing you could simply use:

    [System.Web.Http.HttpGet]
    [GET("range")]
    public HttpResponseMessage Get(DateTime start, DateTime end)
    

    and your URL request can look like this:

    http://localhost:51258/plots/range?start=2013-07-29T21:58:39&end=2013-08-05T21:58:39
    

提交回复
热议问题