Hi,
I want to set up data APIs to be consumes by my Reporting WebApp like this: https://demodata.grapecity.com/swagger/index.html?urls.primaryName=Restful%20NorthWind
This may be a dumb question, BUT, in ASP.NET Zero it appears that I have to do the following to generate my GETs:
public ListResultDto<OrderDataDto> GetOrders()
public OrderDataDto GetOrder(EntityDto input)
What I really want to do is:
public ListResultDto<OrderDataDto> Orders()
public OrderDataDto Orders(EntityDto input)
ie
GET /api/services/app/Data/Orders
GET /api/services/app/Data/Orders/{id}
But this ends up with an error in Swagger. How can I use REST HTTP verbs properly with Data Object names such as with: https://demodata.grapecity.com/swagger/index.html?urls.primaryName=Restful%20NorthWind???
Many thanks
2 Answer(s)
-
0
Hi,
You can use
Route
andHttpGet
attributes on your methods or classes to achive this. You can take a look at https://docs.microsoft.com/en-us/aspnet/core/web-api/?view=aspnetcore-5.0. When you use the same method name in an application service, swashbuckle can't generate the APIs for you. -
0
Duhh - ahh yes, of course. Many thanks!