From the course: Building and Securing RESTful APIs in ASP.NET Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Full and partial updates

Full and partial updates - ASP.NET Core Tutorial

From the course: Building and Securing RESTful APIs in ASP.NET Core

Start my 1-month free trial

Full and partial updates

- [Instructor] Besides the constraints that the HTTP spec puts on the methods used for full and partial updates, it's worth taking a closer look at the semantics of how updates can be handled in a restful API. If we compare the three HTTP methods that can be used for updates, we can see that POST can technically be used for both full and partial updates. But, only PUT can do Idempotent full updates. And PATCH is limited to only doing partial updates. According to the HTTP only POST returns a response body. PUT and PATCH just return a header like 201 created or 204 no content. A common pattern of restful APIs is to send the created or updated resource to the client in the body of the response. Which fits the spec of POST, but not PUT or PATCH. The differences between these methods lead to a couple of common scenarios. One approach is to use all three verbs. POST for creating, PUT for full updates, and PATCH for partial updates. This approach most closely sticks to the HTTP spec. The…

Contents