How to Use Postman for Beginners ? | Super Easy !

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there welcome back to the channel so if you want to be a software engineer want to build things so do anything with computers and you know users you will come across apis someday for sure and from my small experience in this software engineering what i have understood is that everything that we see is kind of an api for example starting from clicking that button in amazon that gets you your product to alexa listening to you and responding back to you everything is using an api so it's pretty important that we know how to play with apis and postman is just the software for that or it helps us in testing the apis or developing them or integrating them for example a backend developer is creating an api right so he's developing it and he can use postman to send requests to the endpoints he's making now that you see that hey is it working or do i need to tweak something now if you're a frontend or ui engineer you want to integrate those apis that the backend developer has made into the app so that the user can see things dynamically happen uh on the app right so in this process uh there is the so so before postman and this kind of software's who you know make a playground for apis uh there was nothing you needed to kind of go to google chrome or something and just paste that localhost url and see hey is this api working go to your network tabs and see a bunch of red red errors and whatnot but with postman it's kind of the software that takes that um you know untidy messy process and makes it super clean and super awesome so it's kind of the thing which most of the engineering teams are using nowadays and most probably you'll be recommended to use that when you want to play with apis so after watching this video you will know how you can get started using postman how to make requests using postman i'll show you all kinds of requests like get post update and stuff and i'll show you some pro things like variable setting in postman so that you don't have to um type one thing with every request and how you can send authentication tokens because some apis like authentication can they need to check that you are the legit user who is sending this request right so how to send a token on a request all these things so basically after watching this video you will be super good at postman and yeah you can use it anywhere you want it would be not a new thing for you so let's just jump into my screen okay cool so this is postman.com if you're coming in for the first time first i'll recommend just select your um the kind of os you're running in and just download the software for that native software and then i'll recommend just sign up for it because in result of that you can just uh the things that you work on the apis or requests that you make will be synchronized wherever you login like if you change systems you'll have the same data right so just sign up for it so after you do all these things uh when you go to postman.com you will come across this your home page this is their home page i have logged in so i'm sort of showing my name now i have windows so i have downloaded the windows app so i'll just open that uh so this is the uh windows thing i guess it will be pretty similar in all the os so you don't have to worry about that cool so this is your home page this is your things now you have workspaces in postman so first um so if you don't have one you can just make a new workspace now you can have different workspaces for example if you're working at on all of your personal projects uh you can make a workspace for that you are working at a company you can make a workspace for that so i have made this my workspace where i keep all my requests and stuff so i'll just get into that postman software kind of seems a bit overwhelming when you see it at first because there are kind of lot of functionalities which is pretty good but um if you are starting out it will seem it seemed to me like a lot when i saw it for the first time but when you start using this stuff you'll be like okay that is super awesome okay so let's start working on it right let's let's make our api requests so in each workspace you have collections you can add different collections now what does this collections mean for example you have made this workspace for a company you're working with now you have a product and you have many features so i can have api for payments i can have my api for users and i want to you know store it as a collection because i don't want to make things messy right so you can add different collections here so you can add as much collection as you want according which apis you want to store i'll name this uh go rest because that's uh api will be using a simple free api that i found which is totally working uh so go rest i'll name it and exactly like that you can see here the name of the collection changed you can you know name payments or whatever your collections name depending on the kind of api that stores because that just makes things clean and as you can see here i made this extra one which you don't need so you can either just right click or press this three dots and delete them super simple right um and i need to work with this go rest things right so i'll get into that um and as you can see here when i click it it says add a request right so here we will have a request it will show all the requests for example here if i show you we have some of the you know get post get put all these kind of requests and exactly like that i will just add a request here right and for your information i'll be using this go rest dot co dot n which is just an api it's nothing it's a free hosted api that you can use to test things so if i just click this this should give me the users uh the server has right so if i just click this without postman you will see something like this even and and even this with our extension installed else you'll just get a very shitty looking thing right so to make this process really cool and in one place postman helps so so i want to get all these things now and to put this thing in my collection right so what i will do here is that copy this thing right copy link address and go to my postman so here so in a request in our new request you can first of all change the name of the request when you work on things you have to do that um because you might share this collection to so this collection to anyone else and he needs to know what is happening here so i i'll name this thing um get users because i'm getting users with this api right get users and the name will change here um and here you can tell okay what is the type of request is it a post request are you putting something in the server or it is a put request or a patch request are you editing something right uh but it is a get request i'm just getting making a request and getting things right so here i'll paste the url that gives me the users i'll just hit send and boom you can see super clean you have the things that the api returns now if you are a ui engineer you will see okay this is the data i get back okay cool so okay i can use this id name by going to data object and that's how you know how you integrate things right so yeah that's how you can you can watch this in different ways like raw but you'll mostly use this pretty because we want to see pretty things right that is a get user and that is done now let me show you how you can post a request post things into for example you want to post a user and test that how that works um so here i'll make add a request and i'll name it post user right now here you will also know um so to post things you need a token if you don't know to post things you need to be so to get things anyone anyone can get things right but to post things you need to be a user and how the server will know your user is by looking at a token that you receive every time you log into the app so first what i will do here is that i will just go to this online dress this go rest and here they have option to click here to get access token click that and it just shows me your token i have logged in and i'll just copy that i'll go back and go back to postman and here you'll see an authorization tab just go there and it is a bearer type token um beer and there are a lot of lots of type of authentication you can do but it is the most common beer token one it is it is that so here you can paste the token that you copied right now i have pasted that you can now save this by control plus s you'll see this um orange things go nothing cool um cool so authorization is shatter setup now uh if you don't know how requests work there are basically some things that go with the header and authorization is one of them so when you do this when you set this token a postman automatically adds this token into your headers right so this uh rectangle this this area is all about requests how what are you sending with the requests and you know all about that so you can send authorization tokens you can see what headers are you sending you can just add some things here sometimes you need to send other things user id and stuff here you can add the key to that the value to that and in the body you can add basically anything that you want to send and this is a post request i want to post a user so i want to uh you know post things about the user so this is a call request it shows but just understand that if it's dash h it goes in headers and if it's d it goes in body or the data right so this is what you have to send this is a format of the thing name gender email status in the body so if i will just try to copy this much uh come back to our postman go to the body because here i will set things that i want to send as i told you so this will be our raw json data right so select json just control plus v and select all of this i'll just remove i'll just remove all this stuff cool now if i just beautify press beautify it will set it in very nice way this is our postman so this is why postman is super useful right uh now these are the things i want to send to the server that hey this is a post request first of all now right i'm posting things now i will get the post url which it should be so here post public slash v1 slash users um and this is the domain so just add it here so this is the full request so this is all we need to do to make a post request in authorization i added a token to say hey i'm a legitimate user let me end let me post the user and in the body i just gave the information that i want to be posted about the user right and what i will do now is just hit send so make sure to give it a pull make sure to make it a post request because it is post not a get request you're not getting things right uh we don't want to get things we want to post right so hit send and boom and it says okay so the email has already been taken so you know it worked but it says that hey the email has already been taken i'll just make some things here and i'll send it again and boom there we go the data has been returned it is 201 the created the request has been fulfilled and resulted in a new resource being created so our request was success right we have made the user now um so that's how you make a post request you that's how you pass authentication just select the type of authentication and give a token here it automatically adds things here if you want anything else to send in headers you can just add them directly here and if you want to send things in body you can do this right now what if i want to you know update things now let's see things for that if you want to patch things right um so if i'll see the id of my user is 211 so here it says this is the url for this is basically the id of the user you want to edit things on right so what i will do now is that uh let's make a new um request for that so add request in my collection i'll say hey this updates um user and um and it is not a get request it is a patch request because patch means what you are patching something you are editing something right uh so that's that and now i will just uh see this is the path for that one to three is the id of the user you want to modify uh things about so that's that the domain i'll just copy it again from here now see this is a tedious process of you know just copying this domain uh every time but we can solve that by using this thing as a set as a variable and i'll show you how to do that let me just make this patch request first so boom this is ready now with patch request what we need obviously we need authorization because we are making a edit to a user right so we'll do exactly that just copy this go to the authorization select bearer token put the thing here put the token here it will automatically get added to your headers requests headers and then in the body i want to say okay i want to change something so i'll say what are the things i want to change right so make it json and here i'll say i want the name to be so we saw right the name was so these are the things the user has so basically i want to i want to make the i want to make the name and the email different right i'll say hey the name should be now sam and the sorry and the email email will be now a threat [Music] be.com right um so this is the things i want to change or this is my url is set up i'll just add uh this id so this was this is id you get after creating this user so i want to make change things of this user so i'll pass this id in the url and i'm just following this thing right here right this is the thing and if you don't um if you want to even see what to send you can just go here in this examples you can see here in the update user um you can send what you can send as data or the body by dash d or this is the headers right cool so it is sending the name and the email and exactly i'm doing that right so if i now send it boom you just get the id is the same the user is the same uh we just see changed its name and its email um right the gender is still same everything is same so a patch request to one so that is how the basics of a postman work that is how you make a request and most of the time you will just be doing this as a programmer and building things okay now let me show you how variables work okay are now you don't need variables with just these two three things but when you are working on real uh big projects or a product on a startup or anywhere big uh you will have collection with lot of things getting shared um in there will be new uh new domain names coming up and there will be one for the developers there will be one for the production all these things happening now every time this changes happen you want to test some api you don't want to just go to all the requests in the apis all the 10 20 requests and just change every time you want to test something you want to have a variable like you want to just change in one thing and you want that to reflect upon every request right so how to do that so first of all i'll copy this because i want to make this a variable right so either you can do this set as a variable but i'll show you the area from where the variables work so just go to go rest or your collections click on that and you'll see your variables right so click on that and here you can add variables just call this variable let's say um site url or something um and then i'll give it a value which will be this gorist um this thing right now just make sure there is a tick mark and i'll just save this and now if i go to get users and here i'll just um and here i'll remove the part that i set as variable and here i'll just mention the variable and you mention a variable by just doing two curly brackets and inside this two curly brackets you write the name of the variable which in my case is site url right so now it's showing very red but i'll see when it senses that okay there is a variable named that it will be orange so boom it is orange now so it saw that okay it exists right now if i just remove the l um unresolved variable right now if i want to test it that hey if this works um i'll just send and yeah you're getting the request that means that it is working fine now you can just copy this and paste this in all your requests now once this is done you can just change things here and it will reflect on every request of yours and you can do this anywhere for example if you want to send even the token the token can be also added in the um here right like that for example if i just say token and boom boom there we go and here i'll just save this go to my authorization and here i'll just add token right boom now that is all you need to do now you don't have to copy paste that whole string everywhere you can just paste it in one in your variables and you can use this variable anywhere you want right you can do this anywhere just remember to use two curly brackets and it will know you are using a variable that's how you use a variable in postman now let's come to something that you will come across when you are joining a team um when you are joining a team they will mostly and you are working with apis and making stuff they will mostly share a collection of postman api requests right so how to import that so imagine this is the thing this is a collection i have made i'm a back-end developer imagine and i've made this and now i want to share this with a ui engineer who just joined the team how will i do that and here you will see this uh share thing right press that um go to via json link then it will give you this link right here right now you can copy that now you can just copy this link and share it to your friend right now after you get this link how you can import this collection to your postman right so if i just copy this now i open my postman and here i will go to my file import here you'll see a link thing right you have got a link and you will so you so you will paste that link here and continue and it will just see you just found out this go rest api right and i'll just press import here uh and it will say me already exist because i already have this thing and i'm just using the same account but um you can just share it to anyone and that's how you export and import things right uh i can import it as a copy too so there we go core is copy and that's how i just shared and exported and imported this right um cool so that was all about postman and i just wanted to make this because when you just first see postman it kind of seems like this really overwhelming thing but it's pretty clean and pretty awesome so do let me know if you learned something from this video got some value out of it and obviously if you love this make sure to smash that subscribe button that means a lot and i'll see you in the next one till then have a great day and keep building [Music] [Music]
Info
Channel: Saumya Nayak
Views: 39,086
Rating: undefined out of 5
Keywords:
Id: PdIwggNFVw0
Channel Id: undefined
Length: 21min 12sec (1272 seconds)
Published: Fri Oct 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.