- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a PUT request in Postman?
A Postman PUT request is used to pass data to the server for the 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 a similar resource more than one time.
Before creating a PUT request, we shall first send a GET request to the server on an endpoint:http://dummy.restapiexample.com/api/v1/employees.
On applying the GET method, the Response body obtained is −
Now, let us update the employee_salary and employee_age for id 21 with the help of the PUT request.
Create a PUT Request
Step 1 − Click on the New menu from the Postman application. The Create New pop-up comes up. Then click on the Request link.
Step 2 − SAVE REQUEST pop-up comes up. Enter Request name then click 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 -http://dummy.restapiexample.com/api/v1/update/21 (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 is shown below −
Step 7 − Click 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.
- Related Articles
- How to create a DELETE request in Postman?
- How to create a POST request in Postman?
- How to see request logs in Postman console?
- How to use Global Variable in Postman Request?
- How to set Multiple Tests for a Request in Postman with JavaScript Method?
- What is Pre-Request Script in Postman?
- How to create a mock server in Postman?
- How to create a Global Variable in Postman?
- How to create sessions in Postman?
- Explain PUT request in Rest Assured.
- How to share Session ID Cookie with another request using Postman?
- How to create and save a collection in Postman?
- How to Create an Environment in Postman?
- Creating Variables using Pre Request Script using Postman?
- How to set a global variable in Postman?
