Operations in Swagger are a combination of a few details around the operation 
itself including the path, parameters, responses and so on.

Operation paths cannot include query parameters, that is, anything coming after 
a ?.

To get the effect you’re looking for, you simply need to define the start and 
end dates as query parameters.

 

 

 

From: <swagger-swaggersocket@googlegroups.com> on behalf of Rem 
<remi.desreum...@gmail.com>
Reply-To: "swagger-swaggersocket@googlegroups.com" 
<swagger-swaggersocket@googlegroups.com>
Date: Friday, 13 January 2017 at 12:09
To: Swagger <swagger-swaggersocket@googlegroups.com>
Subject: endpoint with parameter as date range

 

Hello, 

I am new to swagger and I would like to open and enpoint where the user can 
request with a date range on the info dateInfo

 

between

*StartDate

*EndDate 

 

What's the state of the art to design this endpoint?

 

I came up with this: 

 

infos/startDate={startDate=startDate}&endDate={endDate=endDate}
 
that translates into:
 
·          
o    GET /api/v1/infos/startDate={startDate}&endDate={endDate}
§   
·          
 
I wanted to add the string dateInfo as
 
GET /api/v1/infos/dateInfo?startDate={startDate}&endDate={endDate}
 
but when I launch swagger I got the following error :
 
[ERROR] SendAsync -  The object has not yet been initia
lized. Ensure that HttpConfiguration.EnsureInitialized() is called in the applic
ation's startup code after all other initialization code.'
'   at System.Web.Http.Routing.RouteCollectionRoute.get_SubRoutes()
   at System.Web.Http.Routing.RouteCollectionRoute.GetRouteData(String virtualPa
thRoot, HttpRequestMessage request)
   at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage reques
t)
   at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMess
age request, CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, Ca
ncellationToken cancellationToken)
   at System.Web.Http.Cors.CorsMessageHandler.<SendAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__
18`1.MoveNext()
2017-01-13 20:08:47.4939 [ERROR] Data.API.WebApiTracing+NLogWebApiTracingAdapter
.WriteTrace -  The object has not yet been initialized. Ensure that HttpConfigur
ation.EnsureInitialized() is called in the application's startup code after all
other initialization code.'
'   at System.Web.Http.Routing.RouteCollectionRoute.get_SubRoutes()
   at System.Web.Http.Routing.RouteCollectionRoute.GetRouteData(String virtualPa
thRoot, HttpRequestMessage request)
   at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage reques
t)
   at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMess
age request, CancellationToken cancellationToken)
   at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, Ca
ncellationToken cancellationToken)
   at System.Web.Http.Cors.CorsMessageHandler.<SendAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__
18`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot
ification(Task task)
   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__
18`1.MoveNext()
 
 
Thanks for help.
 
-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to