- Postman - Discussion
- Postman - Useful Resources
- Postman - Quick Guide
- Postman - OAuth 2.0 Authorization
- Postman - Run Collections using Newman
- Postman - Newman Overview
- Postman - Sessions
- Postman - Cookies
- Postman - Mock Server
- Postman - Assertion
- Postman - Collection Runner
- Postman - Parameterize Requests
- Postman - Create Collections
- Postman - Create Tests for CRUD
- Postman - DELETE Requests
- Postman - PUT Requests
- Postman - POST Requests
- Postman - GET Requests
- Postman - Workflows
- Postman - Authorization
- Postman - Environment Variables
- Postman - Environment Setup
- Postman - Introduction
- Postman - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Postman - PUT Requests
A Postman PUT request is used to pass data to the server for creation or modification of a resource. The difference between POST and PUT is that POST request is not idempotent.
This means invoking the same PUT request numerous times will always yield the same output. But invoking the same POST request numerous times will create the similar resource more than one time.
Before creating a PUT request, we shall first send a GET request to the server on an endpoint −
. The details on how to create a GET request is explained in detail in the Chapter – Postman GET Requests.On applying the GET method, the Response body obtained is as follows −
Now, let us update the employee_salary and employee_age for the id 21 with the help of the PUT request.
Create a PUT Request
Follow the steps given below to create a PUT request in Postman successfully −
Step 1 − Cpck on the New menu from the Postman apppcation. The Create New pop-up comes up. Then, cpck on the Request pnk.
Step 2 − SAVE REQUEST pop-up comes up. Enter the Request name then cpck on Save.
Step 3 − The Request name (Test1) gets reflected on the Request tab. We shall select the option PUT from the HTTP request dropdown..
Then enter the URL -
(endpoint for updating the record of id 21) in the address bar.It must be noted that in a PUT request, we have to mention the id of the resource in the server which we want to update in the URL.
For example, in the above URL we have added the id 21.
Step 4 − Move to the Body tab below the address bar and select the option raw.
Step 5 − Then, choose JSON from the Text dropdown.
Step 6 − Copy and paste the below information in the Postman Body tab.
{ "name": "Jenette Caldwell","salary": "2000","age": "15"}
The overall parameters to be set for a PUT request are shown below −
Step 7 − Cpck on the Send button.
Response
Once a request has been sent, we can see the response code 200 OK populated in the Response body. This signifies a successful request and the request we have sent has been accepted by the server.
Also, information on the time consumed to complete the request (673 ms) and payload size (705 B) are populated. The Response body shows the salary and age got updated to 2000 and 15 respectively for the employee having id 21.
Advertisements