Postman Cheat Sheet
Postman is a popular tool used for API testing and development. It provides a user-friendly interface to send requests, inspect responses, and automate testing. Below is a cheat sheet to help you navigate the essential features and functionalities of Postman.
Basic Operations
Create a New Request
Click the
+
button next to the existing tab or useCtrl+T
(Cmd+T on Mac).Enter the request URL and select the HTTP method (GET, POST, PUT, DELETE, etc.).
Save a Request
- Click the
Save
button, choose a collection, and name your request.
- Click the
Send a Request
- Fill in the required details and click the
Send
button.
- Fill in the required details and click the
Request Components
URL Parameters
- Add query parameters by clicking on
Params
and entering key-value pairs.
- Add query parameters by clicking on
Headers
- Click on
Headers
and add necessary headers by entering key-value pairs.
- Click on
Body
- Select the
Body
tab and choose the appropriate format (raw, form-data, x-www-form-urlencoded, binary, GraphQL).
- Select the
Authorization
- Select the
Authorization
tab to choose an authorization type (No Auth, Basic Auth, Bearer Token, API Key, etc.).
- Select the
Collections and Folders
Create a New Collection
- Click the
New
button and selectCollection
. Name your collection.
- Click the
Add a Request to a Collection
- After creating or opening a request, click the
Save
button and select the collection to save it in.
- After creating or opening a request, click the
Create a Folder in a Collection
- Right-click on a collection and choose
Add Folder
. Name your folder.
- Right-click on a collection and choose
Environment Variables
Create an Environment
- Click the gear icon in the top-right corner and select
Manage Environments
. ClickAdd
to create a new environment.
- Click the gear icon in the top-right corner and select
Add Variables to an Environment
- Inside your environment, add key-value pairs. Use
{{variableName}}
in your requests to reference these variables.
- Inside your environment, add key-value pairs. Use
Switch Environments
- Click the environment dropdown at the top right and select your desired environment.
Pre-Request and Test Scripts
Add a Pre-Request Script
- Open a request and select the
Pre-request Script
tab. Write JavaScript code to run before the request is sent.
- Open a request and select the
Add a Test Script
- Open a request and select the
Tests
tab. Write JavaScript code to run after the response is received.
- Open a request and select the
Running Collections
Collection Runner
- Click the
Runner
button at the top left, select the collection, and configure the run (environment, iterations, delay, etc.).
- Click the
Newman CLI
Install Newman via npm:
npm install -g newman
Run a collection using Newman:
newman run path/to/collection.json -e path/to/environment.json
Response Components
View Response
- After sending a request, view the response in the
Body
,Headers
,Cookies
, andTest Results
tabs.
- After sending a request, view the response in the
Response Status and Time
- Check the status code, response time, and size in the response area.
Save Response
- Click the
Save Response
button to save the response to a file.
- Click the
Advanced Features
Monitor
- Click on a collection, then
Monitor Collection
to create a monitor that runs your collection at defined intervals.
- Click on a collection, then
Mock Servers
- Click the
New
button, selectMock Server
, and configure your mock server.
- Click the
Documentation
- Click on a collection and choose
Publish Docs
to generate and share API documentation.
- Click on a collection and choose
Shortcuts
New Tab:
Ctrl+T
(Cmd+T on Mac)Close Tab:
Ctrl+W
(Cmd+W on Mac)Save Request:
Ctrl+S
(Cmd+S on Mac)Toggle Sidebar:
Ctrl+\
(Cmd+\ on Mac)Send Request:
Ctrl+Enter
(Cmd+Enter on Mac)Find:
Ctrl+F
(Cmd+F on Mac)
This cheat sheet covers the fundamental aspects of Postman to help you get started and work efficiently with APIs. For more detailed information, refer to the official Postman documentation.