11. PATCH endpoints
About this chapter
In this chapter we'll implement partial updates using the HTTP PATCH verb and JSON Patch standard, allowing clients to:
- Update specific properties without sending the entire resource
- Perform multiple operations (add, remove, replace, copy, move, test) in a single request
- Reduce bandwidth and improve API efficiency
- Follow REST best practices for partial updates
Note: We'll implement a
PATCHendpoint only for Commands as it would overkill for the Platforms resource.
Learning outcomes:
- Understanding the difference between
PUTandPATCHin REST - Learning about JSON Patch (RFC 6902) specification
- Implementing PATCH endpoints using ASP.NET Core JsonPatchDocument
- Handling partial updates with proper validation
- Testing PATCH operations with various JSON Patch operations
Architecture Checkpoint
In reference to our solution architecture we'll be making code changes to the highlighted components in this chapter:
- Controllers (adding PATCH endpoints)

Companion Code
- The code for this section can be found here on GitHub
- The complete finished code can be found here on GitHub
Feature branch
Ensure that main is current, then create a feature branch called: chapter_11_patch_endpoint, and check it out:
git branch chapter_11_patch_endpoint
git checkout chapter_11_patch_endpoint
tip
If you can't remember the full workflow, refer back to Chapter 5