Skip to content

Instantly share code, notes, and snippets.

@mfaisalkhatri
Last active April 7, 2026 12:18
Show Gist options
  • Select an option

  • Save mfaisalkhatri/4178a8c109fd34d9f973c221ea71c143 to your computer and use it in GitHub Desktop.

Select an option

Save mfaisalkhatri/4178a8c109fd34d9f973c221ea71c143 to your computer and use it in GitHub Desktop.
Difference between PATCH and PUT APIs.
Criteria PATCH PUT
Purpose Partially updates a resource Completely replaces a resource
Request Body Only includes fields that need to be updated Requires the full resource representation
Data Sent Only changed fields Entire data payload
Idempotency Not always idempotent Always idempotent
Use Case Updating specific fields Replacing an entire record
Risk of Data Loss Low, as the unchanged fields remain intact High, if some fields are omitted they may be overwritten or removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment