Base solution for your next web application
Open Closed

REST Verbs #9906


User avatar
0
MarkEaston created

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

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can use Route and HttpGet 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.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    MarkEaston created

    Duhh - ahh yes, of course. Many thanks!

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)