How to create and send POST requests in Postman?
Postman is an API(application programming interface) development tool which helps to build, test and modify APIs. It can make various types of HTTP requests(GET, POST, PUT, PATCH), saving environments for later use, and convert save the API to code for various languages(like JavaScript, and Python). In this article, we will learn how you create and send GET requests in Postman.
Prerequisites:
Steps to create and send POST requests in Postman
Step 1: After downloading and installing the Postman, open the software. Add a new Collection and give it a name like “GFG”.
Step 2: When you hover, on the name of your collection, 3 dots will appear. Click on those 3 dots, and then click on “Add new request”.
Step 3: You need select “POST” request from the dropdown down menu as shown below.
Step 4: Now You can simply paste the API in the space provided and click on Send. Output will be shown in the body with the status code; 201 (Created). Note: You will to pass the body of the object .
How to pass Body:
Lets suppose , our object body is JSON . Then select “Body -> raw -> JSON ” as shown below
Step 5: Then hit the Send button.
Example
Lets suppose we can an API:
https://jsonplaceholder.typicode.com/users
We will send a POST request, with an object body
{
"name": "Nikita",
"username": "nikitamehrotra99",
"email": "nikz@gfg",
"address": {
"city": "Noida",
"zipcode": "300005"
},
"phone": "123456",
"website": "https://auth.w3wiki.net/user/nikitamehrotra99"
}
Output: