0
0
Postmantesting~5 mins

POST request in Postman

Choose your learning style9 modes available
Introduction

A POST request sends data to a server to create or update something. It helps test if the server accepts and processes data correctly.

When you want to add a new user to a website.
When submitting a form with information like name and email.
When uploading a file or sending data to a server.
When testing if the server saves data correctly after receiving it.
When checking how the server responds to new data inputs.
Syntax
Postman
POST /endpoint HTTP/1.1
Host: example.com
Content-Type: application/json

{
  "key": "value"
}

The first line shows the POST method and the URL endpoint.

The body contains the data sent, often in JSON format.

Examples
This sends new user data to create a user named Alice.
Postman
POST /users HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "name": "Alice",
  "email": "alice@example.com"
}
This sends login data using form encoding.
Postman
POST /login HTTP/1.1
Host: api.example.com
Content-Type: application/x-www-form-urlencoded

username=bob&password=1234
Sample Program

This example sends a POST request to create a new post with title, body, and userId.

Postman
POST https://jsonplaceholder.typicode.com/posts
Content-Type: application/json

{
  "title": "foo",
  "body": "bar",
  "userId": 1
}
OutputSuccess
Important Notes

Always set the correct Content-Type header to tell the server the data format.

POST requests usually change data on the server, so use them carefully in tests.

Check the server response to confirm the data was accepted and processed.

Summary

POST requests send data to a server to create or update resources.

They include a body with data, often in JSON format.

Testing POST requests helps ensure servers handle data correctly.