0
0
Postmantesting~5 mins

PUT request in Postman

Choose your learning style9 modes available
Introduction

A PUT request updates or replaces data on a server. It helps keep information current.

When you want to update a user's profile information completely.
When fixing a mistake in a stored record by replacing it.
When uploading a new version of a file to a server.
When setting a resource to a specific state, replacing old data.
When testing API endpoints that modify existing data.
Syntax
Postman
PUT /resource/identifier HTTP/1.1
Host: example.com
Content-Type: application/json

{
  "key": "value",
  "another_key": "another_value"
}

The URL includes the resource identifier to specify what to update.

The request body contains the new data to replace the old resource.

Examples
This updates user with ID 123 with new name and email.
Postman
PUT /users/123 HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "name": "Alice",
  "email": "alice@example.com"
}
This replaces product 456 details with new name and price.
Postman
PUT /products/456 HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "name": "New Product",
  "price": 19.99
}
Sample Program

This example updates the todo item with ID 1 to new details.

Postman
PUT /todos/1 HTTP/1.1
Host: jsonplaceholder.typicode.com
Content-Type: application/json

{
  "userId": 1,
  "title": "Buy groceries",
  "completed": false
}
OutputSuccess
Important Notes

PUT replaces the entire resource; partial updates need PATCH.

Always include Content-Type header when sending JSON data.

Check server response to confirm update success (usually 200 or 204 status).

Summary

PUT requests update or replace existing data on the server.

They require the full new data in the request body.

Use PUT when you want to set a resource to a specific state.