Keith
August 20, 2020, 2:40pm
1
I have a service defined as follows:
[Route("/csv/forward/{QuoteDate}", "GET")]
public class GetCsvForward : IGet, IReturn<GetCsvForwardResponse>
{
public string QuoteDate { get; set; } = "";
}
The problem is that the endpoint (an external service) requires the QuoteDate to be a specified as a query parameter, such as
/csv/forward?2020-08-20
instead of
/csv/forward/2020-08-20
So, I am I able to specify this as a query parameter in the Routing, or am i being totally wrong with my approach?
mythz
August 21, 2020, 5:24am
2
No the route is only for defining the Route’s /path/info
all QueryString or Form parameters are automatically used to further populate the the Request DTO. For the ?2020-08-20
format as you wont have that property on the Request DTO you’ll need to inspect the base.Request.QueryString
collection for any additional keys.
Keith
August 23, 2020, 11:46am
3
I solved the problem by removing the route containing the QuoteDate and adding a route upto where the query parameter is required.
This create the url syntax I needed: csv/forward?quoteDate=2020-05-01
[Route("/csv/forward", "GET")]
public class GetCsvForward : IGet, IReturn<GetCsvForwardResponse>
{
public string QuoteDate { get; set; } = "";
}
Once again, highly impressed with ServiceStack.
1 Like