Skip to content

Instantly share code, notes, and snippets.

@abdelghanyMh
Created February 26, 2025 21:07
Show Gist options
  • Save abdelghanyMh/10bec788ab328b4ff0313d777fb2bb17 to your computer and use it in GitHub Desktop.
Save abdelghanyMh/10bec788ab328b4ff0313d777fb2bb17 to your computer and use it in GitHub Desktop.

Description:

A summary table of HTTP methods (POST, PUT, PATCH) and their roles in CRUD operations, tailored for the Cash Card API. The table clarifies which methods are implemented (bold rows) and their behavior, including URI definitions, response codes, and response bodies. Non-bold rows indicate features not supported by the Cash Card API.

HTTP Method Operation Definition of Resource URI What Does It Do? Response Status Code Response Body
POST Create Server generates and returns the URI Creates a sub-resource under the request URI (e.g., /cashcards/101) 201 CREATED The created resource
PUT Create Client supplies the URI Creates a resource at the exact request URI (e.g., /invoices/1234-567) 201 CREATED The created resource
PUT Update Client supplies the URI Replaces the entire resource with the object in the request 204 NO CONTENT (empty)
PATCH Update Client supplies the URI Partially updates the resource (only modifies specified fields) 200 OK The updated resource

Cash Card API Implementation

  • Bold rows (implemented):
    • POST for creating Cash Cards.
    • PUT for replacing entire Cash Card records.
  • Non-bold rows (not implemented):
    • PUT for creating resources (client-defined URI).
    • PATCH for partial updates.

Notes:

  • Use POST when the server generates the resource URI (e.g., /cashcards/101).
  • Use PUT for full updates (replacing the entire resource).
  • The Cash Card API does not support client-defined URIs (PUT for creation) or partial updates (PATCH).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment