Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • NodeJS Tutorial
  • NodeJS Exercises
  • NodeJS Assert
  • NodeJS Buffer
  • NodeJS Console
  • NodeJS Crypto
  • NodeJS DNS
  • NodeJS File System
  • NodeJS Globals
  • NodeJS HTTP
  • NodeJS HTTP2
  • NodeJS OS
  • NodeJS Path
  • NodeJS Process
  • NodeJS Query String
  • NodeJS Stream
  • NodeJS String Decoder
  • NodeJS Timers
  • NodeJS URL
  • NodeJS Interview Questions
  • NodeJS Questions
  • Web Technology
Open In App
Next Article:
How to set header request in Postman?
Next article icon

Structure of HTTP request in Postman

Last Updated : 23 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Postman is a powerful tool that simplifies the process of making HTTP requests for testing APIs. Understanding the structure of a typical HTTP request in Postman is fundamental for everyone who want to test endpoints. In this article, we'll break down the key components of an HTTP request in Postman in simple terms.

Prerequisite:

  • Postman should be installed and sign in.
  • Able to set up a basic server in Node JS using Express JS

Structure of HTTP request includes:

  • Request Method
  • Request URL
  • Headers
  • Request Body
  • Query Parameters

1. Request Method:

The request method defines the type of action you want to perform. In Postman, you'll encounter methods like GET, POST, PUT, and DELETE. They are used to fetching data, creating something new, updating, or deleting.

request-method
Request method

2. Request URL:

The Request URL is like the address of the destination(endpoint) you want to interact with. It's the location of the API endpoint where you're sending your request. In Postman, you input the URL in the address bar at the top, specifically the server and the specific route you want to hit.

request-url
Request URL

3. Headers:

Headers provide additional information about the request. Common headers include things like Content-Type, which specifies the format of the data you're sending, and Authorization, which might contain authentication details.

headers
Headers

4. Request Body:

The request body is where you include the data you're sending to the server. For example, when making a POST request to create a new user, you'd include details like the username and email in the request body.

Screenshot-2567-01-04-at-183952
Request Body

5. Query Parameters:

Query parameters are additional pieces of information you append to the URL. For instance, if you're searching for articles on a website, you might include a query parameter to filter by a specific topic.When the API endpoint hitted, it will take out the query parameter of it.

query-params
Query params

Steps to test HTTP Requests in Postman :

Step 1: Make a new directory for the project.

mkdir express-server-demo
cd express-server-demo

Step 2: Initialize a new Node.js project and installing required dependencies.

npm init -y
npm install express body-parser

Project Structure:

fgfhjk
Folder Structure

The updated dependencies in package.json file will look like:

"dependencies": {
"body-parse": "^0.1.0",
"body-parser": "^1.20.2",
"express": "^4.18.2"
}

Example: Create a file named server.js and add the following code:

JavaScript
//server.js  const express = require('express'); const bodyParser = require('body-parser'); const app = express();  app.use(bodyParser.json());  app.get('/users', (req, res) => { 	res.send('You have hitted http://localhost:3000/users'); });   app.get('/user/:id', (req, res) => { 	const { id } = req.params; 	res.send(`Hello,You have set query id as ${id}!`); });  // Route to inspect headers app.get('/inspectHeaders', (req, res) => { 	const headers = req.headers; 	res.json({ 		headers: headers, 	}); });  app.post('/login', (req, res) => { 	const { username, password } = req.body; 	res.json({ username, password }); });  app.listen(3000, () => { 	console.log('Server is running on http://localhost:3000'); }); 

To start the server run the following command.

node server.js

Output: Now Open the Postman and perform the necessary action.


Next Article
How to set header request in Postman?

P

pk9918705
Improve
Article Tags :
  • Web Technologies
  • Node.js
  • Geeks Premier League
  • Express.js
  • Geeks Premier League 2023
  • Postman-API-Testing

Similar Reads

  • API Response Structure in Postman
    Postman, a widely-used API testing tool, is essential for developers to interact with APIs efficiently. Understanding the API response structure in Postman is key to successful testing and debugging. From status codes to response body options, Postman provides a user-friendly interface for analyzing
    5 min read
  • Send Get request in Postman
    Postman is a well-known tool for doing Manual API Testing. It has lots of features and at the beginner level, it is used for testing the HTTP responses like GET, POST, PUT, and DELETE. In this article, we will discuss how to deal with Get requests in Postman. What is GET Request?This is an HTTP requ
    3 min read
  • How HTTP POST requests work in Node ?
    The HTTP POST method is used to send data from the client to the server. Unlike GET, which appends data in the URL, POST sends data in the request body, which makes it ideal for form submissions, file uploads, and secure data transfers. In Node.js, handling POST requests is commonly done using the E
    2 min read
  • How to Retrieve the Request Object in PostMan
    Postman is a popular API testing tool used by developers to test, document, and share APIs. While Postman primarily focuses on sending HTTP requests and receiving responses, it also provides features for inspecting request objects. In this article, we'll explore how to retrieve the request object in
    5 min read
  • How to set header request in Postman?
    Postman is a powerful API development tool that offers a feature known as environment variables. These variables are used for efficient testing and development of APIs by allowing users to manage dynamic values across requests easily. In this article, we will learn How you can set header requests in
    2 min read
  • Postman pre-request-script URL not defined
    Postman is an API (application programming interface) development tool that helps to build, test and modify APIs. It can make various types of HTTP requests (GET, POST, PUT, PATCH), save environments for later use, and convert the API to code for various languages (like JavaScript, and Python). In t
    3 min read
  • Sending a Post request in postman pre-script
    Postman stands out as a go-to tool for crafting and testing APIs, offering a robust set of features including API monitoring and script-based testing. Pre-request scripts which are effectively snippets of JavaScript code, play an important role in API testing. This article focuses on discussing send
    2 min read
  • How to Send an HTTP POST Request in JS?
    We are going to send an API HTTP POST request in JavaScript using fetch API. The FetchAPI is a built-in method that takes in one compulsory parameter: the endpoint (API URL). While the other parameters may not be necessary when making a GET request, they are very useful for the POST HTTP request. Th
    2 min read
  • How to Import cURL Request into Postman ?
    Postman is an API development tool that helps us do everything related to APIs, make API calls, perform API testing, create automations, etc. This is a one-step tool to perform operations on the backend server, and show the outputs in various readable formats. In this article, we will learn how to i
    2 min read
  • How to test query strings in Postman requests ?
    To test query strings in Postman requests, we only need to simply enter the key and value of each parameter and Postman will append them to the URL automatically. To the end of the request URL, the parameters are appended using '?' and key-value pairs are separated by '&'. e.g. :- ?id=22&typ
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences