0
0
Postmantesting~5 mins

PATCH request in Postman

Choose your learning style9 modes available
Introduction

A PATCH request lets you update part of a resource on a server without sending the whole data. It saves time and data.

You want to change only the email address of a user without updating their entire profile.
You need to fix a typo in a blog post title without resending the whole post content.
You want to update the status of an order from 'pending' to 'shipped' quickly.
You want to add a new phone number to a contact without changing other details.
Syntax
Postman
PATCH /resource/{id} HTTP/1.1
Host: example.com
Content-Type: application/json

{
  "field_to_update": "new_value"
}

The URL includes the resource ID you want to update.

The request body contains only the fields you want to change.

Examples
Updates only the email of user with ID 123.
Postman
PATCH /users/123 HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "email": "newemail@example.com"
}
Changes the status of order 456 to 'shipped'.
Postman
PATCH /orders/456 HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "status": "shipped"
}
Sample Program

This PATCH request updates the phone number of user 101. Only the phone field is sent, so other user data stays the same.

Postman
PATCH https://api.example.com/users/101 HTTP/1.1
Content-Type: application/json

{
  "phone": "+1234567890"
}
OutputSuccess
Important Notes

PATCH requests should only include fields you want to update, not the whole resource.

Always set the Content-Type header to application/json when sending JSON data.

Check the server response to confirm the update was successful.

Summary

PATCH updates part of a resource without sending everything.

Use PATCH when you want to change only some fields.

Remember to send the correct headers and check the response.