What is Postman and why everyone use it ?

Hitesh Choudhary
7 Apr 202428:33

Summary

TLDRIn this video, the speaker, Hes, enlightens viewers on the true capabilities of Postman, far beyond its common perception as a simple API testing tool. Hes dispels the myth that Postman is merely for sending web requests and receiving responses, emphasizing its status as an industry standard among developers. The tutorial delves into Postman's advanced features, including writing code for workflow automation, using variables, and generating tests. Hes guides viewers through practical examples, such as creating collections, setting up pre-request scripts, and leveraging Postman's environment and documentation. The video is a call to action for developers to harness Postman's full potential, promising to reveal the 'monster' capabilities hidden within this free tool.

Takeaways

  • πŸ”§ Postman is a powerful API development tool that goes beyond just sending web requests and receiving responses.
  • πŸ‘¨β€πŸ’» It is considered the industry standard and is widely used by over 30 million developers, including both back-end and front-end developers.
  • πŸš€ Postman started as a simple tool but has evolved to include features that allow for automation and scripting within the tool itself.
  • πŸ’Ό Postman is free for individual users, with paid plans geared towards enterprise users.
  • πŸ“š The script mentions the importance of understanding Postman's full capabilities, which are often underestimated by many users.
  • πŸ› οΈ Postman allows users to write code to automate workflows, making it a versatile tool for developers.
  • πŸ”— The video script demonstrates how to use Postman for API testing, including creating and managing collections and requests.
  • πŸ”„ Postman supports various types of requests beyond HTTP, such as GraphQL, gRPC, WebSocket, and Socket.IO.
  • πŸ“ The script showcases how to use variables and pre-request scripts in Postman to dynamically generate data for testing.
  • πŸ” Postman provides a console for monitoring the traffic of requests and responses, which is useful for debugging and understanding API behavior.
  • πŸ“ˆ The video emphasizes the learning potential of Postman, pointing to its Learning Center and documentation as resources for users to deepen their knowledge.

Q & A

  • What is Postman and why is it considered an industry standard by many developers?

    -Postman is a collaboration platform for API development that allows for sending web requests and receiving responses, but it is much more than a simple tool. It offers features like automation, workflow enhancement, and the ability to write code within the platform. It's considered an industry standard because of its extensive capabilities and widespread adoption by over 30 million developers, including both back end and front end developers.

  • How did Postman originate and what was the motivation behind its creation?

    -Postman was created out of frustration with the limitations of using web browsers and browser plugins for API development. The founders decided to launch Postman as a standalone tool to overcome these limitations, leading to its continuous development and evolution into a comprehensive API development platform.

  • What are some of the advanced features of Postman that go beyond just sending web requests?

    -Postman's advanced features include the ability to write code for automation within the platform, the creation of collections to organize and manage API requests, the use of variables to streamline requests, and the generation of documentation. It also supports different types of requests beyond HTTP, such as GraphQL, gRPC, WebSocket, and Socket.IO.

  • How does Postman handle authentication and how can it be used to automate API testing?

    -Postman can handle authentication by allowing users to include authentication details in their requests. It can automate API testing through the use of variables, pre-request scripts, and tests that can be written to check the validity of responses and data, making it a powerful tool for developers to ensure API reliability and functionality.

  • What is the significance of Postman's variable system and how does it aid in API development?

    -Postman's variable system is significant because it allows for dynamic and reusable components in API requests. Developers can set variables for parts of the request that remain constant, like base URLs, or that need to change, like user IDs or passwords. This makes the API development process more efficient and less error-prone.

  • How can Postman be used to generate random data for testing purposes?

    -Postman can generate random data through its dynamic variables feature. Users can create variables that produce random strings, numbers, or even emails, which is particularly useful for testing APIs under various scenarios without manually changing data each time.

  • What is the role of the Postman Console and how does it assist in debugging API requests?

    -The Postman Console provides a view of all the traffic going in and out of Postman, including request headers, request bodies, and response data. It assists in debugging by allowing developers to inspect the details of each request and response, which is crucial for identifying and fixing issues in API interactions.

  • How does Postman facilitate collaboration among development teams?

    -Postman facilitates collaboration by allowing teams to share collections, which are sets of API requests. This enables multiple developers to work on the same set of APIs, see each other's changes, and maintain consistency across the team's API development efforts.

  • What are some of the learning resources available for developers to enhance their Postman skills?

    -Postman offers a Learning Center that includes tutorials, documentation, and examples to help developers improve their skills. It also has a community forum similar to Stack Overflow where users can ask questions and find solutions to common problems, making it a valuable resource for continuous learning and improvement.

  • How can Postman be integrated into a developer's workflow to improve efficiency?

    -Postman can be integrated into a developer's workflow by using it for all stages of API development, from initial request drafting to final testing and documentation. By using features like collections, variables, and tests, developers can streamline their processes, automate repetitive tasks, and ensure consistent and reliable API performance.

Outlines

00:00

πŸ”§ Introduction to Postman's True Power

The speaker, Hes, introduces the video by explaining that Postman is not merely a tool for sending web requests and receiving responses; it's an industry standard utilized by over 30 million developers worldwide. Hes aims to dispel the misconception that Postman is simple and instead reveal its full potential. The history of Postman is briefly touched upon, highlighting its evolution from a basic request tool to a sophisticated development asset. The speaker also mentions the ability to write code within Postman to automate workflows and refers to Postman's extensive documentation as a learning resource. The video promises to delve into Postman's capabilities beyond simple web requests.

05:01

🌐 Exploring Postman's Interface and Web Requests

Hes demonstrates how to use Postman's interface, starting with creating an account and navigating the dashboard. He discusses the importance of collections in organizing web requests and shows how to create a new collection and add requests to it. The video also covers setting variables within Postman to streamline requests, using the 'Set as Variable' feature to simplify repetitive tasks. Hes emphasizes Postman's ability to handle various types of requests beyond HTTP, such as GraphQL, gRPC, and WebSocket. The speaker also introduces the concept of using Postman's console to monitor traffic and inspect responses, setting the stage for more advanced topics.

10:02

πŸ”„ Postman's Automation and Dynamic Data

The video segment shows how to automate testing with dynamic data in Postman. Hes explains the process of registering a user through Postman, using variables to generate random data like email addresses and passwords. The speaker encounters an issue with role validation and decides to resolve it by writing a pre-request script to randomly select a valid user role. Hes demonstrates how to use Postman's scripting capabilities to interact with environment variables and customize request data dynamically, showcasing Postman's flexibility in testing scenarios.

15:05

πŸ’» Debugging and Scripting in Postman

Hes encounters a problem with the random username generation and decides to debug it by writing a pre-request script to create valid usernames. The speaker walks through the script, explaining how to loop through letters and randomly select characters to form a username. Hes also shows how to check the response in the console and adjust the script accordingly. The video segment highlights the importance of debugging and the power of Postman's scripting for automating and personalizing API testing.

20:07

πŸ”— Testing and Integration in Postman

In this part, Hes focuses on testing the registration API effectively by automating the process in Postman. The speaker shows how to extract data from responses for future use, such as logging in, and how to save and reuse variables for consistent testing. Hes also introduces the concept of generating tests in Postman, which automates the process of verifying responses and checking for expected fields. The video segment emphasizes the integration of testing within the development workflow and how Postman streamlines this process.

25:08

πŸ“š Postman Learning Center and Community

Hes concludes the video by encouraging viewers to explore the Postman Learning Center for further insights into Postman's capabilities. The speaker mentions the availability of documentation, scripting guides, and community forums as resources for learning and problem-solving. Hes reflects on the video's aim to change the perception of Postman from a simple tool to a powerful development asset. The call to action for feedback and further exploration of Postman's features wraps up the tutorial.

Mindmap

Keywords

πŸ’‘Postman

Postman is an API platform for building and using APIs. It is not merely a tool for sending web requests and receiving responses, as many might initially assume. In the video, the speaker clarifies that Postman's capabilities extend far beyond this basic function, positioning it as an industry standard for developers. Postman allows for the creation of collections of API requests, the use of variables to streamline workflows, and the integration of scripts for automation, showcasing its comprehensive role in API development and testing.

πŸ’‘API

An API, or Application Programming Interface, is a set of rules and protocols for building and interacting with software applications. In the context of the video, APIs are the focus of testing and development using Postman. The video discusses how Postman can be used to send requests to APIs to check their functionality, emphasizing the importance of APIs in both back-end and front-end development.

πŸ’‘Collection

In Postman, a 'Collection' is a group of related API requests that can be organized and run together. The video script mentions creating a collection as a way to manage and reuse API requests efficiently. This feature is highlighted as part of Postman's ability to streamline the API development process by allowing developers to group and execute multiple requests with ease.

πŸ’‘Variable

Variables in Postman are used to store values that can be reused across API requests, making it easier to manage dynamic data. The script explains how to set a variable within a collection, which can be used to avoid hardcoding repetitive data like server URLs. This feature is showcased as a way to enhance productivity and maintain flexibility in API testing.

πŸ’‘Environment

An 'Environment' in Postman refers to a set of variables that can be used across different collections or requests. The video discusses the concept of environments and how they can be used to switch between different API endpoints or configurations, such as development, testing, and production environments. This feature is emphasized as a powerful tool for managing different states and configurations in API development.

πŸ’‘Scripting

Postman supports scripting within requests, allowing for automation and dynamic data manipulation. The video script includes a demonstration of writing pre-request and test scripts, which can be used to generate random data, set up test conditions, and automate testing processes. Scripting in Postman is portrayed as a way to enhance the testing capabilities and customize the API development workflow.

πŸ’‘Documentation

Documentation in the context of the video refers to the detailed information and guidelines provided by Postman for its users. The speaker mentions that Postman's documentation is a valuable resource for learning more about the platform's features and capabilities. Documentation is highlighted as a key aspect of Postman's user support, enabling developers to maximize the tool's potential.

πŸ’‘Testing

Testing in Postman is a core theme of the video, where the speaker discusses how Postman can be used to test APIs by sending requests and evaluating responses. The video illustrates the use of Postman's features like variables, scripting, and collections to automate and manage the testing process, emphasizing the importance of thorough testing in API development.

πŸ’‘Automation

Automation in Postman is the process of using scripts and collections to perform repetitive tasks without manual intervention. The video script includes examples of automating API testing by generating random data, setting up test scripts, and running collections of requests. Automation is presented as a way to save time, reduce errors, and increase efficiency in the API development lifecycle.

πŸ’‘Workflow

Workflow in Postman refers to the sequence of steps and processes that developers follow when building and testing APIs. The video script explains how Postman can be integrated into a developer's workflow to improve efficiency and organization. By using features like collections, environments, and scripting, developers can create a structured and repeatable process for API development.

πŸ’‘Learning Center

The Postman Learning Center is a resource mentioned in the video, which provides tutorials, documentation, and community support for users to enhance their Postman skills. The video encourages viewers to explore the Learning Center to unlock the full potential of Postman, indicating that it is a valuable platform for continuous learning and improvement in API development.

Highlights

Postman is not just a tool for sending web requests and getting responses; it has much more functionality.

Postman is considered the industry standard by many developers for API testing and development.

Over 30 million developers use Postman, indicating its widespread adoption and utility.

Postman allows users to write code to automate workflows, enhancing its utility beyond simple API testing.

Postman is free for individual users, with paid plans aimed at enterprises.

The presenter demonstrates how to make a web request using Postman and explains the process in detail.

Variables in Postman can be set at different scopes, such as collection or environment-specific.

Postman's Console provides insights into the traffic of requests and responses, aiding in debugging.

Postman supports various types of requests beyond HTTP, including GraphQL, gRPC, WebSocket, and Socket.IO.

The use of variables and dynamic content in Postman can simulate real-world scenarios for testing.

Pre-request scripts in Postman enable the manipulation of data before a request is sent.

Postman's ability to generate random data, like emails and passwords, is showcased for dynamic testing.

The presenter discusses how to handle errors and invalid responses when testing APIs with Postman.

Postman can automate testing through the use of collection runs and the generation of test scripts.

Postman's Learning Center and documentation are highlighted as valuable resources for users.

The video concludes with a call to action for viewers to explore more of Postman's capabilities.

Transcripts

play00:00

hey there everyone my name is hes and in

play00:03

this video we are going to talk about

play00:05

what is postmen and in case you are

play00:07

thinking that I know postmen Postman is

play00:10

just a simple tool through which I can

play00:11

send the web request get some response

play00:14

back and just check out whether my API

play00:16

are working or not no my friend you are

play00:19

absolutely wrong in that case of course

play00:22

Postman does exactly that but it's not

play00:24

just that simple that you can explain

play00:26

the postman by hey it sends a request

play00:28

and gets the response this is exactly

play00:31

the point where a lot of people make

play00:32

mistake I mean just think for a second

play00:36

just think for a second and just realize

play00:39

why everybody on the Internet calls that

play00:42

Postman is the industry standard for

play00:44

every developer whether it's a back end

play00:46

or it's a front end why almost every

play00:48

developer says that hey my company uses

play00:50

Postman and if you just look at this on

play00:53

their website in itself you'll notice

play00:56

they say that over 30 million developers

play00:58

use postmen so there might be something

play01:02

that we are absolutely missing about the

play01:04

postman than sending just the web

play01:06

request and this is exactly that video

play01:08

where you understand that how you can

play01:10

utilize the postman I'll walk you

play01:12

through with a small glimpse and hints

play01:14

of where the power of the postman comes

play01:16

around and of course we're going to be

play01:18

going through with the postman this

play01:19

video will help you to understand what

play01:21

all and what more you can do with the

play01:23

postmen and of course we'll answer the

play01:25

question what is Postman so in the early

play01:28

days Postman used to be a a very simple

play01:30

client in which you can just send the

play01:32

request and get the response back it

play01:34

used to be done mostly with the web

play01:36

browsers and some of the plugins of the

play01:39

browsers which is not a good idea for

play01:42

working with that so one day the

play01:44

founders of the postmen got really

play01:45

frustrated and they said I'm going to be

play01:47

launching this tool on its own so that

play01:49

we can make more than making the web

play01:51

request rest is all history and the

play01:53

postman was born out of that and through

play01:56

which postman has seen a constant

play01:58

development cycle and it is St still not

play02:01

stopping on that part it is now not just

play02:03

a request uh mechanism tool it does so

play02:06

much more and we're going to be seeing a

play02:08

glimpse of that not only that you can

play02:10

write code inside the postmen to

play02:12

automate so much of your workflow in

play02:14

fact that's just a part of it which I'm

play02:16

sharing you I'll show you the

play02:17

documentation of the postman to to share

play02:19

that what more you can learn directly

play02:21

from the postman documentation and the

play02:23

best part of course it's free you you're

play02:25

already using it I'm just want I'm just

play02:28

here to make sure that you understand

play02:29

what power Postman brings to you and why

play02:31

you are not using it and all the people

play02:34

who are pro developers experienced

play02:35

developers they are using it every day

play02:38

so we're about to here to change this

play02:40

one and let's go ahead and get started

play02:42

so let's start with the basic that this

play02:45

is the postman website and you see that

play02:47

30 million developers are here and if

play02:49

you just go ahead and look at their

play02:50

pricing uh this is the best thing that

play02:52

everybody can see that hey this is

play02:54

Basics and all not and whatnot uh but we

play02:56

all know that postmen is free uh you can

play02:58

just go ahead and use that these Postman

play03:00

pricings are for the Enterprise they

play03:02

don't charge for Indie developers

play03:04

anything at all although the pricing

play03:05

page is pretty nice what all we offers

play03:07

and all of that uh but yeah as a

play03:09

individual user it it doesn't cost me

play03:11

any money I just use it and it it

play03:14

generously offers me anyways we we're

play03:15

not interested in that part we are more

play03:17

interested in something more so I have

play03:19

already created an account and this is

play03:21

how the postman account looks like by

play03:23

the way uh if you want to use Postman

play03:25

without this you can just go ahead and

play03:26

do that I prefer to have my account

play03:28

because we use it in and out in all of

play03:30

our application first uh how can we use

play03:33

this where can we make the web request I

play03:35

do have an open source project on this

play03:37

we're going to utilize this uh but you

play03:39

can use any of the web request for that

play03:41

so the project is free api. app and in

play03:44

this we can just check the project we

play03:45

will check the project while writing

play03:47

some of the scripts but all I want to

play03:49

show you is cooked in docs once you open

play03:51

the cooked in docs uh this is how you

play03:53

can make a web request so uh we'll go in

play03:56

the authentication because that's where

play03:57

we need to automate some of the stuff

play03:59

but let's just say right now we'll see

play04:00

the public apis I want to grab a random

play04:04

joke book stocks what should I get

play04:07

random code random code would be really

play04:09

nice so uh there's random Cotes and

play04:12

there is a random get one random code so

play04:15

IID like to make a web request onto this

play04:16

one I can go ahead and try this out and

play04:19

I can execute this and I can see that

play04:22

okay this is the point where the web

play04:24

request was made although this is very

play04:26

nicely cooked Docks but not all the

play04:28

application that you're developing

play04:30

doesn't have this kind of really nice

play04:32

cooked in docks you want to just see how

play04:34

it's going on in the local host and make

play04:36

a collection of it all right so this is

play04:38

what I get uh in the response about the

play04:41

author and all the author Slug and the

play04:44

content and all of that now the whole

play04:46

idea is I want to just go ahead and copy

play04:48

this whole thing and I want to make the

play04:50

same request with the postman to just

play04:52

get started and then we are going to

play04:53

write some scripts automate that to see

play04:56

the true power of the postman so what

play04:58

I'll do is I'll just go on and open the

play05:01

postman this is what we have this is how

play05:03

it looks like uh maybe you want to log

play05:05

in not log in that's up to totally your

play05:07

call now next thing is I want to make a

play05:10

web request the first thing that you're

play05:11

going to see is I can just click on the

play05:13

new and it opens up the web request the

play05:15

type of web request I can make I can

play05:17

make an HTTP Tada obvious but we can

play05:20

also make the graphql grpc websocket

play05:23

request socket IO whatever you want to

play05:25

go we can go with that I don't usually

play05:27

go with this kind of a style because

play05:29

this is just one off a request let's go

play05:31

ahead and try that then I'll walk you

play05:32

through with what I use as a workflow

play05:34

majorly of the time I can just start a

play05:36

web request I can just go ahead and say

play05:38

hey this is my web request go ahead and

play05:40

make a get request on this one by the

play05:42

way of course you can use or you can

play05:44

type the new method as well but I'm

play05:45

happy with the get I'll just go ahead

play05:47

and send the web request and that's the

play05:49

major use case from the majority of

play05:52

people that this is it maybe I'll just

play05:54

save it but let me walk you through with

play05:56

the true power of how the postman

play05:59

actually goes go ahead and work for it

play06:01

so what I'll do is I'll just remove this

play06:03

I don't want to save it majority of the

play06:05

time I just go ahead and try to create a

play06:07

collection for this one so I'm going to

play06:09

go ahead and create a blank collection

play06:11

but you have a whole lot of templates

play06:13

that you can use around once you are uh

play06:15

familiarized with how to utilize Postman

play06:18

and its true hidden superpowers I'll

play06:21

start with the basics so I'll just go

play06:22

ahead and create a b blank collection

play06:24

and I'm going to name this collection as

play06:27

a YouTube uh demo Postman YouTube demo

play06:31

is good enough all right now inside this

play06:34

YouTube demo collection I can add a web

play06:36

request but you can also go ahead and

play06:38

see that there is so much more that you

play06:39

can go ahead and work with that yes this

play06:42

is what I really like that how much

play06:44

superpow is there and how much you can

play06:46

utilize this so I'll just go ahead and

play06:48

move this here so that we can see it all

play06:50

up here so this is what we have now I'll

play06:53

just go ahead and click and I'll say

play06:54

that I want to add a request you can add

play06:56

subfolders into this if there's a need

play06:59

for this so I'll just let's just add the

play07:01

folder and in this folder I'm going to

play07:03

go ahead and call this one as uh public

play07:05

because that's what we are calling and

play07:07

inside the public further I want to add

play07:09

a request by the way you can add outside

play07:11

as well but I'll add the request here

play07:13

now in this I would love to make a

play07:15

request to this one so we see that okay

play07:17

it works it works really nice but

play07:19

obviously in the very near future I'll

play07:21

be making more web requests to this

play07:23

entire API and that the routes could be

play07:25

different but I have noticed already

play07:27

that api. free api. apps / API slv1 this

play07:31

is going to remain exactly the same so

play07:33

how we can make this a little bit easier

play07:35

I can just go ahead and select all of

play07:37

this and yes it pops up says set as

play07:40

variable I'm going to go ahead do this

play07:42

uh I'll set as a new variable I'm going

play07:44

to call this one as uh my uh server

play07:48

looks pretty good and further I'll

play07:50

select the scope so scope is something

play07:52

that this variable should be available

play07:54

to all of the collections that I have or

play07:57

particular collection that I'm asking it

play07:59

or the active environment I I'll talk

play08:01

about the environment probably later on

play08:03

but right now I'll just say in this

play08:04

collection only this should be available

play08:06

this is my scope of this variable just

play08:08

set the variable and that's it now this

play08:11

is set as variable makes my life a

play08:13

little bit easier yes still it makes

play08:14

this it send the web request but makes

play08:16

my life a little bit easier things are

play08:19

okay at this point and you say hey I

play08:21

know this part this is pretty obvious

play08:23

can you show me something really nice

play08:24

let me walk you through first of all if

play08:26

you look at this part here uh this is a

play08:28

little hard to see but this is here you

play08:30

can go ahead and see the console that

play08:32

what requests are going in this is all

play08:34

the traffic that is going outside of the

play08:36

postman and all the traffic that's

play08:38

coming in that's here in the response we

play08:41

have the cookies we have uh the headers

play08:43

whatnot and all these things this is

play08:45

what is coming in now to explore things

play08:48

in a little bit more and we'll be

play08:50

writing some code as well uh let me walk

play08:52

you through that part as well now if I

play08:54

go back onto this docs we have done with

play08:56

the public request we are pretty aware

play08:57

of it we'll close this one not

play09:00

interested in the public API part I'm

play09:02

more interested in doing some

play09:04

authentication while doing the

play09:05

authentication the first step is

play09:07

obviously to register a user I go ahead

play09:09

and uh do this I want to try this out uh

play09:12

heads up I tried this before making this

play09:14

video so obviously this test user might

play09:17

be already registered but we'll see that

play09:19

I'll go ahead and execute this and this

play09:21

gives me a response that you know what

play09:23

the status code and all the thing user

play09:24

is already registered let's try to

play09:26

modify this so how can I modify this I

play09:28

can go ahead and change things here user

play09:30

email and domain so instead of this

play09:32

we'll go ahead and say this one is uh

play09:35

example if I can write that that would

play09:37

be really

play09:39

nice there we go uh user. email instead

play09:42

of that uh let's go ahead and uh call

play09:45

this one as t t. example uh password is

play09:48

okay role is admin and we're going to be

play09:50

changing the username as well to T I'm

play09:53

pretty sure that's not register although

play09:55

this is public API and people register

play09:56

all kind of users but we reset that in

play09:59

our database uh timely let's go ahead

play10:01

and try to execute now if I execute this

play10:04

is the response that I got that hey user

play10:06

was successfully registered in your

play10:09

application okay nothing nothing super

play10:12

uh extreme in that case but let's go

play10:14

ahead and try let me show you the power

play10:16

of the postman I'll copy this route and

play10:19

now let's go ahead and create another

play10:21

folder where I want to check the O uh

play10:23

create new folder and add a folder I'll

play10:26

call this one as o and inside the Au

play10:30

we'll make a new request obviously this

play10:33

request is going to be of type uh post

play10:36

but I don't have to copy the entire URL

play10:38

because I know that I can just go ahead

play10:40

and use uh my server this is a variable

play10:44

and after that I can make uh whatever

play10:46

the slash request is so in this case it

play10:47

is just the slash userregister makes

play10:51

life a little bit

play10:53

easier I'll go back and I'll just say

play10:55

hey this is what where I want to send

play10:57

the request of course this is a post

play10:59

kind of request if I send the request

play11:01

just like this it will say hey email is

play11:02

required email is invalid all those

play11:05

validation check by the way we'll go

play11:06

into the code part as well of this open

play11:08

source repository uh this is really nice

play11:11

I'm happy with this but this is not the

play11:13

response I'm looking up forward so I

play11:15

need to send some data although this

play11:17

docs really help that I have to send

play11:18

this kind of a data how can I send this

play11:20

pretty easy uh you have all these

play11:22

options to send the body if I check the

play11:25

body here I have the option to send form

play11:27

data we have the option of uh URL

play11:30

encoded forms you have raw data and all

play11:32

of that by the way with the form data

play11:33

you can change the type text to file and

play11:35

can send the files as well uh just the

play11:37

basics or you can set the binaries send

play11:39

the files directly I'll show you some

play11:41

fun stuff around that as well but in

play11:43

this case I'm more interested in the raw

play11:46

and there's a lot of data type you can

play11:47

send I'll just send the Json and this is

play11:50

how you send the Json request oh this is

play11:52

fun okay now this is what the example

play11:55

what we have but this user is already

play11:57

registered we know that part if I if I

play11:59

go ahead and send this oh this is

play12:01

already registered a user with this

play12:03

email and username already exist ah this

play12:06

is nice so we have a response which is

play12:08

already being done now first interesting

play12:10

part is I can just make a right click or

play12:13

a click on this one and uh you can do so

play12:16

much more onto this one that you can

play12:18

actually save this uh as an example as

play12:21

well I'll just go ahead and we'll save

play12:23

it later on but right now I want to

play12:25

worry something that hey this is not

play12:26

going to work any given time if I have

play12:29

to come up here and have to work it like

play12:32

this this is definitely not going to

play12:35

work I cannot come up with different

play12:36

emails every single time I have to check

play12:38

this one this is the first interesting

play12:39

stuff comes up in the postman itself you

play12:43

can just remove this email start your

play12:47

variable holders placeholders two curly

play12:49

braces and then you can use a dollar

play12:52

sign look at the list of it yeah uh you

play12:55

can just go ahead Postman knows it that

play12:58

there is so much Randomness that happens

play13:00

while testing that's why I say this is a

play13:02

testing first company they knows the

play13:04

stuff that is being randomly used notice

play13:06

here pretty much anything that you want

play13:08

but there are some things which are not

play13:10

there how can I come up with that that's

play13:12

where we are going to learn so in this

play13:13

case I I'm going to go ahead and say I

play13:16

want a random email this will generate a

play13:19

random email for me pretty cool okay uh

play13:22

let's go ahead and see that if it is

play13:23

able to do this or not uh let's go ahead

play13:26

and send a post request uh user user

play13:29

with email or username already exists so

play13:31

right now user with either email or the

play13:34

username is already exist but I want to

play13:35

see this let's see in the console and if

play13:38

I go ahead and open up the post request

play13:40

uh notice here the post request I can go

play13:42

ahead and check all of this request

play13:44

header I can see the request body as

play13:47

well and there we go this is my email

play13:49

which is absolutely random told you it's

play13:53

it's super fun and you are not utilizing

play13:55

its true superpow uh let's go ahead and

play13:57

close this and send one more to just see

play14:00

this notice here the new one comes

play14:01

around and at least this part is working

play14:04

I'll open the request body and I'll say

play14:06

hey there is this one another Hotmail

play14:08

user guess Postman loves Hotmail I don't

play14:11

know okay so one part is solved how can

play14:14

I grab the password as well can I go

play14:16

ahead and grab the password just like

play14:17

this yes you can just do that oops too

play14:20

many curly braces and I can use a dollar

play14:23

sign and I can there's so much more into

play14:25

this one and I can go ahead and use a

play14:27

random password is there a random role

play14:29

available as well let's go ahead and try

play14:31

this obviously Postman doesn't know what

play14:33

kind of role we are supporting in our

play14:35

open source project so I'm pretty sure

play14:37

that doesn't exist random

play14:39

roll no such thing as random roll if

play14:42

you'll do this it's it's going to be a

play14:44

bad request but we need to see those bad

play14:46

request as well that's the testing send

play14:48

this open the

play14:49

console and open this part and what

play14:53

we're going to do is okay and let me

play14:56

just go ahead and move this here a

play14:58

little bit you can see it properly and

play15:01

here is my response body and in this

play15:05

invalid user role what you're saying uh

play15:08

request body here and there we go

play15:10

password is there random R the variable

play15:12

was shipping in as it is this is not

play15:14

good this is not good I want to send

play15:16

something more uh this is not going to

play15:18

cut through so there is two challenges

play15:20

in front of me first of all this random

play15:22

roll it's not working and the random

play15:24

username this is not working so what you

play15:27

can do further in the postmen you can

play15:29

come up into the

play15:30

prequest script uh perfect name I don't

play15:33

need to explain it more all the script

play15:35

that runs before you send your request

play15:37

that's it TAA so what I want to do is

play15:41

let's just say I have a function and

play15:42

I'll do a deliberate mistake here just

play15:44

warning you in advance I'll just go

play15:45

ahead and say get a random rule so I'm

play15:48

defining my own function here by the way

play15:50

you can use Arrow functions as well I

play15:52

like to go with the classic uh I'll go

play15:54

ahead and say I'll go with the roles and

play15:56

what roles you have and we are going to

play15:58

say we do have an admin we do have a

play16:01

user and probably we do have guest so

play16:05

these are my roles now I want to select

play16:06

a random role based on this pretty easy

play16:09

you can go ahead and find roles and we

play16:12

can just use whatever the index is B

play16:15

based on it's a classic JavaScript yes

play16:17

JavaScript works everywhere almost

play16:19

everywhere uh we'll just float it out

play16:21

and then we're going to go ahead and say

play16:24

math and we are going to use a random

play16:27

there we go we have randomized the stuff

play16:29

and we can multiply it by

play16:33

roll dot length so there we go now it is

play16:37

governed by the RS length and we will be

play16:39

able to grab it uh now there are a

play16:41

couple of uh problems and hints uh that

play16:43

okay I have defined my function but how

play16:46

does my body is going to know that hey I

play16:48

do have these uh new variables available

play16:51

for me so all you have to do is PM yes

play16:54

there is a thing known as PM Postman yes

play16:59

and you can just go ahead and say dot

play17:01

there is ton of thing that you can do I

play17:03

bet you didn't know about it so you can

play17:05

go ahead and set about the cookies

play17:07

environment

play17:09

execution honestly I'm not even aware

play17:12

about all of them I just use few of them

play17:14

so one thing that I often use is pm. uh

play17:18

environment yep that's the one and

play17:20

there's only couple of options that you

play17:22

use for the environment you either set

play17:23

it clear it mostly you just set it or

play17:26

get it I I rarely clear the stuff so the

play17:28

get one is here uh sometimes I do check

play17:30

has as well but very rarely we we can

play17:33

just go ahead and use get so not the get

play17:36

we want to set the environment first my

play17:38

bad so what do you want to do is when

play17:40

you want to set an environment you pass

play17:42

on what environment variable name should

play17:44

be and how should I set it uh how it's a

play17:46

easy part get random role and go ahead

play17:48

and execute that so that you return a

play17:50

role and where should I return this role

play17:53

so simple just go ahead and call this

play17:55

one as random role now that a new

play17:58

variable is is available I can just go

play17:59

ahead and save this the only thing you

play18:01

have to keep in mind is when you check

play18:04

the body you cannot now just use the

play18:06

dollar the dollar sign is reserved for

play18:08

the postman variable itself this is not

play18:10

a postman variable this is hes variable

play18:13

I I designed it anyways I can just go

play18:15

ahead and say the random role now it is

play18:18

not going to do our job entirely but

play18:20

it's it's a one step ahead I'll just

play18:22

click on Save first then I'll open up

play18:25

the console I can clear the console and

play18:28

now let's go ahead and send the request

play18:30

there we go we have send the request it

play18:32

doesn't still does the job notice here

play18:34

it's it's still Falls we'll come up

play18:35

there I'll just open the postmen I'll

play18:37

open the request body and I need to

play18:40

shift this I need to open the request

play18:42

body and then in the request body notice

play18:45

here the role name is guest so this is

play18:47

coming in now this is giving us a

play18:49

problem but the username is also giving

play18:51

us the problem so first we'll solve the

play18:53

username problem and then we'll solve

play18:56

the rest of the problem so username how

play18:58

should we get the username now there are

play19:00

lots of ways on the username of getting

play19:02

that I'll just grab a username which is

play19:04

all lowercase so I'll just go ahead and

play19:06

say

play19:07

function get a random username just like

play19:12

that we'll just go ahead and work with

play19:13

this I can just go ahead and write these

play19:15

scripts now the first thing that I have

play19:17

to do is grab all the letters so I'll

play19:19

just go ahead and grab this now how can

play19:21

we do this let username equals to just

play19:24

like that we'll Loop through all the

play19:26

values I wish there could be some

play19:27

suggestions there but hey I'm asking too

play19:29

much so I'll just go ahead and write

play19:32

this like this for let i h really

play19:36

boring we start with the zero and then

play19:38

we go ahead how much long the username

play19:41

you want I'll just say I want just the

play19:44

seven letters here and I'm going to go

play19:46

ahead and say i++ really basic oops so

play19:50

this is my Loop and in that I'll just go

play19:52

ahead and say this username needs to

play19:54

plus equal uh with the letters and the

play19:58

character at which character I'm going

play19:59

to be choosing I'll be doing the math

play20:01

random again can I copy paste this at

play20:04

least this part I can copy

play20:06

paste H why not copy and paste this so

play20:11

we have a mt. floor we have a mt. random

play20:14

and that's going to get multiplied by

play20:15

the letters length this time super easy

play20:19

letters. length not bad all right uh

play20:21

once this is all done we'll go outside

play20:23

of the loop and we'll just go ahead and

play20:25

say I want to return the username hope

play20:27

that is cooked so now it is pretty sure

play20:29

that the username will come up uh this

play20:32

whole thing is pretty nice and easy I'll

play20:34

just go ahead and get some space for me

play20:37

I can I duplicate this oh I can use the

play20:39

keyboard shortcuts oh I didn't knew that

play20:42

uh we can just go ahead and say get

play20:44

random username just like that and I'll

play20:47

just say this one is random username

play20:50

pretty cool and now in the body this is

play20:53

not going to still solve the problem

play20:54

I'll show you some of the open source

play20:56

hacks as well uh I can just go ahead and

play20:59

copy this stuff why should I copy

play21:03

this and I can just go ahead and say

play21:06

random username these are my variables

play21:08

uh it's still not going to solve the

play21:10

problem but that's not the postman

play21:11

problem this is how we debug the stuff

play21:13

so I thought I'll include that part as

play21:15

well I'll open this up and I'll say that

play21:18

hey let's make a web request let's open

play21:20

the console clear this up and I'll send

play21:23

this request so let's see what's

play21:25

happening in here again move it a little

play21:28

bit here uh response body and there we

play21:31

go username is coming in nicely and we

play21:34

have the password everything is pretty

play21:36

good this should actually go through

play21:39

this should go through this didn't got

play21:42

me the error this should go through ah

play21:43

this this this goes through uh let's

play21:46

let's try it one more time oh there we

play21:48

go invalid user role so why we are

play21:50

getting invalid user R we saw that it

play21:52

works but at the way uh I have designed

play21:55

this tutorial the way things should have

play21:57

happened is we should have got this one

play21:59

first so why is this invalid role uh

play22:01

this is where the open- source uh power

play22:03

comes in that I can go ahead and look in

play22:05

the project itself I'll open this

play22:07

project in a new tab and this is the

play22:09

whole source code that we have available

play22:11

here now I want to see what's happening

play22:13

in the source code to see that hey what

play22:15

kind of users you are actually accepting

play22:17

what roles you are accepting I just

play22:18

wrote it as randomly admin user guest

play22:20

but I have no idea how the roles are

play22:22

actually going in this is where you see

play22:24

the source code of an open source

play22:26

project I'll just probably Zoom it a

play22:27

little bit and and the first obvious

play22:29

step is go and check out is should

play22:33

be uh let's go ahead and uh see where

play22:37

are the models here are the models in

play22:39

the O in the user model let's see how

play22:42

the user model is being defined if I

play22:43

check this one here oh there's a user Ro

play22:46

enums where is this uh it's coming up

play22:48

from the constant. JS so I'll hunt for

play22:50

the constant I can just search for it as

play22:52

well but I know uh we designed it so I

play22:55

know that constant. JS I can just go

play22:58

into it and oh this is where you are

play22:59

saying so you have you're supporting

play23:01

only admin and the user as a role oh

play23:03

nice I can modify this app as hey I'm

play23:06

not supporting the guest uh maybe some

play23:08

other app is so I can reuse my script

play23:10

I'll just use go ahead and save this and

play23:12

that's it I fixed the bug and now if I

play23:14

make a web request it is every single

play23:17

time going to uh just work with that and

play23:20

there we go now whenever I need to test

play23:23

my register API this is an automation

play23:25

work all I can do is work for this not

play23:28

only this is I can save these variables

play23:30

even I can show you how to save these uh

play23:32

responses and extract some of the data

play23:35

like for the login purpose if I go ahead

play23:37

and check how do you log in uh let's go

play23:40

ahead work like that how do you log in

play23:42

what data you need you need password and

play23:43

username only so I can extract from this

play23:46

whole response uh that give me just the

play23:49

username and the password yep username

play23:52

and the password and I can store the

play23:54

password uh from this or I can just

play23:57

create instead of random password just

play23:59

one password for all the tests which is

play24:01

a common practice I can just go ahead

play24:03

and do that now in the future I can just

play24:06

click on this o and uh not the O this

play24:09

entire collection I can just go ahead

play24:11

and start run collection so every single

play24:14

request that is there will automate

play24:15

there and go ahead and check uh whether

play24:17

I'm doing all okay or not now if I go

play24:20

ahead and look onto this one uh you'll

play24:23

see that there's so much more that is

play24:24

going on with this one uh just one more

play24:26

fun stuff because you are so interested

play24:28

in this one I can just go ahead and look

play24:30

for YouTube demo and I can say generate

play24:33

tests yeah that's nice and I can

play24:35

generate test for whatever the request

play24:37

I'm looking up forward I'm interested in

play24:39

this post new request so I'll just go

play24:41

ahead I should have saved this with some

play24:43

name that would really make sense so

play24:45

I'll just go ahead and call this instead

play24:47

of new request uh we'll call this one as

play24:50

register that's that's better actually

play24:53

uh now let's do oops wrong click I can

play24:56

go ahead and say generate test which

play24:58

which is in beta but I still love it it

play24:59

does the job uh this is my register

play25:01

request so I'll just go ahead and see

play25:03

this okay this is really nice and I can

play25:05

just go ahead and register the test uh

play25:08

this is fairly a new feature uh but

play25:11

we'll just go ahead and we'll just say

play25:12

generate the test and now it's uh

play25:15

couldn't add this due to previously

play25:17

failed request fix the request oh we

play25:19

have to fix this we forgot to save my

play25:21

bad uh and uh okay we'll just remove

play25:25

this public we are not interested in

play25:27

this part delete this forgot to

play25:30

save okay this one is save this one is

play25:34

save let's go ahead and send this and

play25:37

there we go we are doing absolutely fine

play25:39

now now I can go ahead and hit the

play25:40

generate test again let's just generate

play25:43

this now this is generating it's working

play25:45

on it you see the test there and verify

play25:48

the avar object is present in the

play25:49

response it it does it on its own a

play25:51

little AI there but I can fix that I can

play25:53

see in the body what is the status code

play25:56

and I can just go ahead and save this uh

play25:57

respon code you can see that hey and

play26:00

notice here it's actually even writing

play26:02

these whole things for me can I just go

play26:04

ahead and move things here anyways so

play26:07

notice here again pm. test so you can

play26:09

you're writing automated test scripts

play26:11

for that required field that these are

play26:13

expected Fields valid format email is in

play26:16

valid format you can just go ahead and

play26:18

write your own as well but hey these

play26:19

tests are being generated so anyways you

play26:21

get the power of this one but I'm not

play26:23

done yet I'm not done yet this is just

play26:25

to make spark the Curiosity in you that

play26:28

there is so much more in the postman so

play26:30

stop calling it as just hey this is

play26:33

anyways in the postman if you go ahead

play26:35

and look on this there is a postman

play26:37

Learning Center yes because there is so

play26:39

much that happens in this one I think

play26:41

it's worth spending your time into this

play26:43

one if you just go ahead and get started

play26:45

with send request response and all of

play26:47

this but there's so much more in the

play26:48

postman flow collaboration and whatnot

play26:51

you can even look at the postman docs as

play26:53

well which is still in the Learning

play26:54

Center if I just move this here uh what

play26:57

you'll notice this is in the Learning

play26:59

Center in itself there is so much that

play27:01

you can do and uh if I just look at the

play27:04

write script part and write pre-quest

play27:06

script write the test with monitors

play27:08

write test this is where I saw this hey

play27:11

I can do so much of scripting in the

play27:12

postman and they give you nice examples

play27:14

of how postmen collection variables set

play27:18

details God knows what uh this is all

play27:21

you can do and you can just edit them

play27:23

work with that next steps write the

play27:24

tests this is how you can work with that

play27:27

and there is so much so much more that

play27:29

you work with that even uh if you want

play27:31

to get the random email there is a

play27:33

community. postman where you can find so

play27:35

much of answers it's like their own

play27:37

stack Overflow uh but it's already

play27:40

pretty default and work with that so uh

play27:43

this is the basics of how I want you to

play27:45

see the postman from a different

play27:47

perspective so yes I know this is a 30

play27:50

minute long video about what is Postman

play27:53

but I think somebody needed to come out

play27:56

and say that Postman is beyond just

play27:58

sending the request and getting the

play27:59

response and I think with the demo you

play28:02

understand more so now if you're a

play28:03

backend developer or a front-end

play28:05

developer you truly understand what kind

play28:08

of monster the postman is it is super

play28:11

crazy powerful and that's why I'm a big

play28:13

fan of it and it's free and that's why I

play28:15

love it even more so that's it for this

play28:17

video if you want me to uh design a

play28:20

little bit more on the postman side like

play28:22

what more we can do and how we can uh

play28:24

integrate it in our workflow let me know

play28:26

in the comment section I would love to

play28:27

do that uh that's it for this video

play28:29

let's catch up in the next

play28:31

one

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Postman TutorialAPI TestingWeb DevelopmentDeveloper ToolsREST APIAutomationScriptingAPI DocumentationWorkflow OptimizationTesting Strategies