0
0
PostmanHow-ToBeginner ยท 4 min read

How to Make PATCH Request in Postman: Step-by-Step Guide

To make a PATCH request in Postman, select PATCH from the HTTP method dropdown, enter the request URL, and add the data you want to update in the Body tab using JSON format. Then click Send to execute the request and see the response.
๐Ÿ“

Syntax

A PATCH request updates partial data on the server. In Postman, the syntax involves:

  • HTTP Method: Select PATCH from the dropdown.
  • URL: Enter the API endpoint you want to update.
  • Headers: Usually include Content-Type: application/json to specify JSON data.
  • Body: Provide the JSON with fields to update.
http
PATCH https://api.example.com/items/123
Headers:
  Content-Type: application/json
Body:
  {
    "name": "Updated Item Name"
  }
๐Ÿ’ป

Example

This example shows how to update the "name" field of an item with ID 123 using a PATCH request in Postman.

http
PATCH https://api.example.com/items/123
Headers:
  Content-Type: application/json
Body:
  {
    "name": "Updated Item Name"
  }
Output
{ "id": 123, "name": "Updated Item Name", "description": "Original description", "price": 25.00 }
โš ๏ธ

Common Pitfalls

Common mistakes when making PATCH requests in Postman include:

  • Not selecting PATCH method and using PUT or POST instead.
  • Forgetting to set Content-Type: application/json header, causing the server to reject the data.
  • Sending the full object instead of only the fields to update, which can overwrite data unintentionally.
  • Using incorrect JSON syntax in the body.
http
Wrong way:
POST https://api.example.com/items/123
Headers:
  Content-Type: application/json
Body:
  {
    "name": "Updated Item Name"
  }

Right way:
PATCH https://api.example.com/items/123
Headers:
  Content-Type: application/json
Body:
  {
    "name": "Updated Item Name"
  }
๐Ÿ“Š

Quick Reference

StepAction
1Open Postman and select PATCH method from dropdown
2Enter the API endpoint URL
3Go to Headers tab and add Content-Type: application/json
4Go to Body tab, select raw and JSON format, then enter fields to update
5Click Send to execute the PATCH request
โœ…

Key Takeaways

Always select PATCH method in Postman to update partial data.
Set Content-Type header to application/json when sending JSON data.
Include only the fields you want to update in the request body.
Check JSON syntax carefully to avoid request errors.
Use the Body tab with raw JSON format to send update data.