In this lesson, we explore how to implement the Update operation in a RESTful API, specifically focusing on adjusting the balance of a Cash Card by updating the amount on an existing database record. The key steps involve creating a new endpoint to receive HTTP requests with the appropriate verb (PUT), URI, and body, and returning suitable responses for success and error conditions.

PUT and PATCH:

PUT and POST:

Implementation Decisions:

Security Considerations:

Summary Table of HTTP Methods and CRUD Operations:

HTTP Method Operation Definition of Resource URI What does it do? Response Status Code Response Body
POST Create Server generates URI Creates a sub-resource under the given URI 201 CREATED The created resource
PUT Update Client supplies URI Replaces the resource at the given URI completely 204 NO CONTENT (empty)

Bold rows indicate the methods we are implementing.

Conclusion: