DEV Community

Cover image for API 101 USING POSTMAN
Sonu
Sonu

Posted on

API 101 USING POSTMAN

Hello Folks, Welcome to your Own Blog, Introduction To Api's Using Postman. Together we will learn and explore more about Api's using Postman.

Let's Understand What's an API?:
Understand it by Considering it as a digital restaurant. It acts like a waiter your role is like a client who orders Something via Waiter and it Sends the request to the Server and gives output Accordingly.
Now In Technical Means:

  • Application Programming Interface (APIs) allow Services to Communicate with each other.
  • The Software has become more complex and Collaborative over the years. Developer no Longer need to create service From scratch.
  • APIs allow developers to access data from a service (like Google or Twitter) without any knowledge of how the codebase has been implemented.
  • There is an API for everything like the cat API, OpenWeatherMap, Genius, Discord, Youtube-to-MP3, etc.

Now, Coming to postman API:
Postman is scalable API testing tool that Quickly Integrates into CI/CD pipeline. It is collaborative API development platform that simplifies creating using, and testing APIs with a UI. It has become Much Easier to work with URLs using postman instead of doing tedious tasks via command lines.
Here Is the View Of Postman:
Postman
Essentials To Retrieve and Update API Data:

Methods, Addresses, Parameters, Authorization, Body Data
Enter fullscreen mode Exit fullscreen mode

Request and Responses: We interact with api's using 3 ingredients that help us to make requests:

Method (Get, Post, etc), Address/Endpoint(URL), Path
Enter fullscreen mode Exit fullscreen mode

Postman
We Build Our Requests By Specifying Details Like:
Parameters (In the Query), Authorization, Headers and Body (Data Types)
So What is the Point even after doing a lot many things we don't get output, right?
Responses Elements
Status Codes(200 OK, 201 Created,404 Not Found), Headers, Accessing Body data
Now Let's Do Some Practical Implementation:
Implementation Of Joke API:- Copy Endpoint URL Paste On Get Data, See Output:- Hello World!
GETs Method -
By default, we have 4 jokes with id [0-3]
To get a random joke: {base_url}/joke
To get a specific joke: {base_url}/joke/{id of joke}

Postman
Postman
Post Method -
{
"id": "1",
"author": "Ali Mustufa",
"joke": "Bugs are features",
"source": "iali.dev"
}

Post
Here View Of Joke Api:-
Post
Put (Update Joke)
{
"id": "1",
"author": "Ali Mustufa",
"joke": "Bugs are updated features",
"source": "iali.dev"
}

Put
Here View Of Updated Joke Api:-
Put
Delete (Joke):-
To delete a joke: {base_url}/joke/{id of joke}

Delete
Here is The View After Delete:-
Delete
I Hope You All Got A Basic Understanding Of Api's
Thank You So Much!!!

Special Thanks To Ali Mustufa Sir

Discussion (0)