Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Developer Circle: Mombasa profile imagec a
c a forDeveloper Circle: Mombasa

Posted on • Originally published atchrisdevcode.hashnode.dev on

     

Using Postman Like a Pro!

Alt Text

Postman logo

Postman is an API testing platform. You can use postmanweb platform:

postman web

or thedesktop application for testing your APIs.

desktopostman.png

Postman can be used to test all API requests:get/put/create/delete

If you are new to postman, I'd suggest you go through their Bootcamp:https://web.postman.co/bootcamp

I will be using the desktop application for the demos, they're no big differences from using the web version of postman.

What this article covers:

  1. Creating collections
  2. Adding requests
  3. Creating environments and Variables

Creating Collections:

In Postman, collections are folders where you put all APIs with similar descriptions or projects together. It is a pretty neat way to organize your APIs for testing.

https://www.postman.com/collection/

Follow the few steps to create an API collection:

  1. Ensure that you are on thecollections tab by clicking on theCollections with a folder icon on the top left side menu.

Postman Collections

On the right of theCollections notice the "+" icon and on hovering it, a pop up with the message: "Create new Collection" appears.

Create new collection - postman

  1. Click the "+" icon to create a new collection. Notice a new folder is createdNew Collection and a new tab opened simultaneously.

created collection

Right-click on the folder and selectrename to give the collection a name of your choosing or double click on thenew collection name on the tab to rename.

double-click.png

right-click.png

PSST! I will rename mine toDemo

Adding requests to a Collection:

On hovering over the collection name on the left panel. notice the 3-horizontal-dots, click on it to open a quick menu.

Add a new request

SelectAdd request and notice a new tab opens:

new-request.png

Let's add an API endpoint and make a request:

https://jsonplaceholder.typicode.com/users
Enter fullscreen modeExit fullscreen mode

Paste the URL in the input label with a placeholder text "Enter request URL", ensure the method on the left is set to "GET" and hit 'Send' to make a request.

Making a request

The response:

response.png

Creating environments and Variables

An environment in postman is just a collection of variables to be used in a request or a collection

https://learning.postman.com/docs/sending-requests/managing-environments/

The selected environment status is at the top-right of Postman, the default is "No environment".

Here is how we create a new environment and add our variables:

On the left side of the postman web/app, click on theEnvironment.

Click on the "+" icon to create a new environment, then give it a name.

new-env.png

To create a variable, manually fill the details on the environment tab:

I will create a variable for the base URL of the API endpoint:https://jsonplaceholder.typicode.com/

VARIABLE: urlINITIAL VALUE: https://jsonplaceholder.typicode.com/CURRENT VALUE: https://jsonplaceholder.typicode.com/
Enter fullscreen modeExit fullscreen mode

variable

To use the variable, go to the request tab and replace thehttps://jsonplaceholder.typicode.com/ with{{url}}

Then on the top-right, select an environment (select the one you just created from the Dropdown).

After that, make the request to see if everything went well:

env-var.png

That is it, to view the demo use:

Run in Postman

NOTE

There are many ways to create a variable, environment or collections in Postman, I just highlighted the common ones. Feel free to hover on the postman docs to learn and practice more:

https://learning.postman.com/docs/getting-started/introduction/

MY BIO

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Let's connect, share and build!

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp