How to Route non-CRUD actions in a RESTful ASP.NET Web API?

前端 未结 3 1634
自闭症患者
自闭症患者 2020-12-20 12:11

I am trying to design a RESTful web API for our service using ASP.NET Web API. I\'m running into trouble with figuring out how to route non-CRUD actions to the proper contr

3条回答
  •  一生所求
    2020-12-20 12:58

    From a REST perspective you probably want to be treating the lock as a resource in and of itself. This way you create and delete the lock independently of the door (although presumably locate the lock endpoint from the door representation). The URL of the resource is probably going to be related to the URL of the door, however from a RESTful perspective this is irrelevant. REST is about relationships between resources, so the important part is that the url of the lock is discoverable from the representation of the door.

提交回复
热议问题