Hi everyone I am back with my new article. last time I told you about my journey on how I got my student expert badge from postman, but today I will show you how to use postman as a beginner. Here we will see the basic CRUD (Create Read Update Delete) operations. I am considering that you have the basic knowledge on JavaScript , API's (Application Programming Interface) and it's status codes
Tools and resources
Postman (Either download the postman client or you can use its web Version or you can add the postman google chrome extension to your browser)
Json Placeholder API(This is an API which we will use in postman)
Getting started with CRUD
get
A get
request is used when we want to get some data from an API.
Suppose If I ask you that what is name?
you will reply me your name (Say, my name is Jhon).
In this example you are the API, my question is the get request and your answer is the response. Now let's perform this task in real.
Open the postman click on the +
tab to create a new request and then select Get request form the dropdown and paste
this URL in the Enter request URL
place holder and then click on the send
So, in this above video you can see that on sending a get request using postman, we got a response i.e. data as JSON (JavaScript Object Notation) with a status code 200.
post
A post
request is used when we want to send data to a server using an API.
Suppose you have written something on a paper, so in this case what you have written is the data and the pencil you are using is the API and the paper is the server.
Now again in the postman then paste the same URL, this time choose post request from the dropdown, then click on body > raw >json and write some json content in the placeholder and hit the send button
{
"userId": 697,
"id": 10,
"title": "post request ",
"body": "this request is created by kk"
}
put
A put
request is used when we want to update any data that we have posted earlier to the server, using API.
Suppose you have written an essay on a paper and now you want to update something in it, in this case Your pencil will be API and the paper will be the server and you can update anything on the paper
Now again in the postman then paste the URL, this time choose put
request from the dropdown, then click on body
> raw
>json
and write some json content in the placeholder this time lets change the content
{
"title":"This title is updated"
}
We have again got a status 200 which means that output request was successful
delete
A delete
request is used to delete some data from a server using an API.
Considering the last example, after writing an essay, now you want to erase it using an eraser, in this case your paper will be the server and eraser will be the API.
Now again in the postman let's send a delete request to this URL,
We have again got a status 200 which means that output request was successful
So this is the end of this article, feel free to comment if you have some queries, stay tuned for next