
What is Postman
Postman is a platform for API
Development
Testing
Management
Step 1 - Goto Postman website https://www.postman.com/ | Create Account
Check Email and verify account
Step 2 - Login to Postman
Step 3 - Explore GUI and features
Step 1 - Select the HTTP Method
Step 2 - Add the API endpoint
Step 3 - Add Headers, Authorizations etc as needed
Step 4 - For POST, PUT requests add Body
Step 5 - Save & Run, Check response
In web services, POST requests are used to send data to the API server to create or update a resource. The data sent to the server is stored in the request body of the HTTP request
It's worth noting that a POST request is non-idempotent
It mutates data on the backend server (by creating or updating a resource), as opposed to a GET request which does not change any data
Similar to POST, PUT requests are used to send data to the API to update or create a resource
The difference is that PUT requests are idempotent. That is, calling the same PUT request multiple times will always produce the same result
In contrast, calling a POST request repeatedly make have side effects of creating the same resource multiple times
Generally, when a PUT request creates a resource the server will respond with a 201 (Created), and if the request modifies existing resource the server will return a 200 (OK) or 204 (No Content)
A PATCH request is one of the lesser-known HTTP methods
The difference with PATCH is that you only apply partial modifications to the resource
The difference between PATCH and PUT, is that a PATCH request is non-idempotent (like a POST request)
To expand on partial modification, say you're API has a /users/{{userid}} endpoint, and a user has a username
With a PATCH request, you may only need to send the updated username in the request body - as opposed to POST and PUT which require the full user entity
As the name applies, DELETE APIs delete the resources (identified by the Request-URI)
DELETE operations are idempotent. If you DELETE a resource, it’s removed from the collection of resources
Some may argue that it makes the DELETE method non-idempotent It’s a matter of discussion and personal opinion
1. What is COLLECTION
2. How to create Collection
3. How to create folders inside collection
4. How to arrange requests inside collection
Collection is a group of API requests
Raghav Pal
Can create variables at the following levels (scope)
Global
Collection
Environment
Data
Local
Priority
Local
Data
Env
Collection
Global
Set Variables with script
Global: pm.globals.set("name", "Edison");
Collection: pm.collectionVariables.set("name", "Newton");
Environment: pm.environment.set("name", "Rutherford");
Local: pm.variables.set("name", "Ramanujan");
Environment is a set of key-value pairs
Step 1 - Create an api request
Step 2 - Create environments and add key-value pairs (variables)
Step 3 - Refer the variables in request
Step 4 - Select the environment from dropdown and run request
Step 5 - Create more environments and execute request
Postman contains a powerful runtime based on Node.js that allows you to add dynamic behavior to requests and collections
You can add JavaScript code to execute during 2 events in the flow:
Before a request is sent to the server, as a pre-request script under the Pre-request Script tab.
After a response is received, as a test script under the Tests tab.
Postman will prompt you with suggestions as you enter text. Select one to autocomplete your
code
You can add pre-request and test scripts to a collection, a folder, a request within a collection, or a request not saved to a collection
Tests in Postman are JavaScript code that is executed after receiving response
Step 1 - Create a API request
Step 2 - Check the tests section under
Request
Collection
Folder
Step 3 - Create and run tests
Debugging scripts can be written under either the Pre-request Script tab or the Tests tab, with helpful messages logged in the Postman Console
The Postman Console logs the following information:
● The primary request that was sent, including all underlying request headers, variable values, and redirects
● The proxy configuration and certificates used for the request
● Network information such as IP addresses, ciphers, and protocols used
● Log statements and asynchronous requests from test or pre-request scripts
● The raw response sent by the server before it's processed by Postman
This course is created for complete beginners.
Get started with POSTMAN step by step.
If you are a complete beginner on Postman, this course is for you. Very basic step by step videos to guide you from scratch.
In this session we will learn
What is POSTMAN
How to download and install
Understand Postman GUI
Create Collections, Variables, Environments and Tests
Data Driven Testing
Run from command-line and Jenkins
Let's Get Started...