DEV Community

Cover image for Bye bye Postman ! Let's share your REST API calls in team, easily !
Jonathan BROSSARD for Monisnap

Posted on

Bye bye Postman ! Let's share your REST API calls in team, easily !

As developer, we are using tools to make REST API calls (Postman, Insomnia, PostWoman...), and these tools are very usefull.

The limits

Make calls to test an API is fine, but if you want to edit, version, or simply share it with your team ... it's not very handy.

Indeed, you can use Postman paid plans for instance, but it means that you need to pay, and it means that all your team needs to use Postman, again one more tool...

Do you know REST Client ?

Logo REST Client VS Code Extension

REST Client* is a VS Code extension.

It will let you to send HTTP requests and view responses into VS Code. And only based on a text file, which can easily be versioned among your repository. 🙏

Pros

The main advantage is to be able to version and share your API calls.

If you're working on an internal API, you may want to share how to test a new endpoint with your colleagues.

REST Client is a good easy way to do it !

Another good point is simplicity. All you need to do/have, is ONE file. Also, if you jump between projects and do not remember how works an API/Service on which you did not work since a while, just look at this file !

Cons

You have to use VS Code... but for a lot of known reasons among internets, you are using Emacs, VI, or VS Code 😄

What's next ?

Here is how to begin.

The file

Only create a file with .http extension, for instance doc.http

And then, VS Code will show you the file as :

doc.http preview into VS Code

And by clicking on "Send Request", a new tab with all request response details will be opened.

doc.http response preview into VS Code

Go further

You may also use environment variables to easily switch between you env and avoid any api-key or token manually update in the file, or url update etc...

Here is how to use environment variables, just like that :

Here, I created 4 environments : local, dev, staging, production.

These 4 environments have their own host and token variables, with their specific values.
But they also share a variable, named partnerUniqueToken (don't ask me why ... too many partners don't have several env...).

Hope it helps !

Big up to Julien who discovered this extension !

Oldest comments (113)

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

Many thanks @ankush981, indeed, probably one of the best reason : "why open another RAM-hungry app" !

Collapse
 
psupanova profile image
Peter Edwards

Ram-hungry? Equipment is cheap compared to salaries these days running out of ram should just not happen even with swapfile disabled

Thread Thread
 
faridos profile image
faridos

Maybe some people play games while building the app and testing lol

Thread Thread
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

It's more like a mind-set, I don't want to have "one more" app launched. We all already have IDE, Chrome, Sequel, Slack, Trello, Terminal ...

Collapse
 
harlock123 profile image
Lonnie Watson

For Peter Edwards...
Some unfortunate souls are forced to work with underwhelming equipment that benefit from not having yet another tool running. Regardless of capacity... My personal stuff runs circles around the dev env I have to use for work. Everything I can do with something like VS code I do to make that work system at least usable....

Thread Thread
 
gergelypolonkai profile image
Gergely Polonkai

Even if i’m not forced (i could easily afford expanding my RAM), some simply doesn’t want to. I refuse to buy RAM just to run another RAM-hogging app (most probably a “Desktop App” built on Electron) and will use a less RAM-demanding, actually native program. If there is none, i need to be really interested in the platform to put some money in using it (not the case most of the time).

So please, optimize for RAM. Even with today’s tech like SSD drives and such it worth it.

Collapse
 
vicoerv profile image
Vico

Yeah, lagging will mess my mood. if it's not 60fps then I'll not code hahaha just kidding 😂

Collapse
 
mohdraqif1 profile image
mohd.raqif

It's nice but one thing to consider. You can share the whole workspace of postman either with a single person or with a team, your choice. I think that reduces the pain of editing the source code or it's syntax maybe.😁

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

Hi @mohdraqif1 . Yes, you're right, but by putting it into your repo, you can be sure that it's always up to date :) I think that we should never be afraid of updating code/repo.

If we're afraid, it may mean that we are not confident :)

Collapse
 
beelzenef profile image
elena

sounds good, thanks!

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

Thanks @beelzenef !

Collapse
 
cirelli94 profile image
Cirelli

I think the good idea is to have the tests in your repository.
Is there a way to place insomnia/postman configurations in our own repos?
It's not a problem to open another program to me.

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

Hi @cirelli94 , yes you can. You could export your Postman calls into a json config file and store it into your repository. But, each time you make an update into Postman, unfortunately, you have to re-export file. You can't just open your versioned json config file into Postman, make your updates, and just make Ctrl+S, it doesn't work, because Postman save it into the Postman application directory.

Collapse
 
cirelli94 profile image
Cirelli

Mm maybe insomnia?
The problem is that in an office you can't impose a IDE, my coworker would kill me 😆

Thread Thread
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

I understand ^

Don't know about Insomia, as VS Code fit our needs based on our stack, it's for us the best IDE in term of IDE and save a lot of time (versionning, unit tests, integration tests, lint etc..) :)

Thread Thread
 
nilskp profile image
Nils Kilden-Pedersen • Edited

Why can you impose Insomnia or Postman, but not VSCode?

Thread Thread
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

VS Code is pretty perfect for our stack, so actually, if I would change my IDE, I still did not find better. About Postam, Insomnia, I do not impose it to my team, but if I want, in repositories, everyone can share API Calls, REST Client is perfect and free.

Collapse
 
devjonny profile image
Jonny Olliff-Lee • Edited

REST Client is such a great tool. We using extensively for the purpose of testing, and sharing examples in our project repos.

The ability to use JSONPath to follow links or grab values from your API response to form the next request is invaluable. Not to mention really great for demonstrating how REST APIs are meant to look and work!

If you've not tried it, give it a go. You need to name your request with:

# @name MyAwesomeRequest

But then once you've invoked it you can access a variable of the same name so {{ MyAwesomeRequest... }} the request and response plus the headers and body for both.

It's only more recently I stumbled across the environments feature, but that's made a huge difference in cutting down the noise of declaring loads of variables that change per environment.

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

Hi @devjonny !

Totally agree, grabing values from previous API responses is amazing and let you easily test calls sequences.

Many thanks for this sharing, hope it could help readers to deep dive on this such great extension !

Collapse
 
machineroom profile image
James

curl. That's all.

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

😄

Collapse
 
alejandrorios profile image
Alejandro Rios

Is there a version of this for Jetbrains??

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap
Collapse
 
alejandrorios profile image
Alejandro Rios

😮 I didn't know it, thanks

Thread Thread
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

💪

Collapse
 
davidrock profile image
David Rock

Insomnia.

Collapse
 
thebojan profile image
Jordan Munroe

Holy balls this is awesome! I'm working solo at the moment so keeping Postman up to date has been at the absolute bottom of my priority list... My workspace already has 5 necessary windows up(VS, Server console, Code and Chrome) and having to switch between them is already a nightmare without introducing Postman to the mix.

Being able to test the API without leaving Code would be a godsend! Damn am I happy your article showed up in my feed, thanks a googolplex! I didn't even think about using something other than Postman.

Collapse
 
monisnapjonathan profile image
Jonathan BROSSARD Monisnap

Hi @thebojan , that's a limit we had with Postman and its workspace... Very happy that we can help you :)

Collapse
 
tjaj profile image
TJ

For linux users we don't need any rest client because cURL is more easy

Collapse
 
jubotho profile image
Светослав Митов

There's curl for windows too, but rest client is quite different thing in a team development perspective