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 ?
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 :
And by clicking on "Send Request", a new tab with all request response details will be opened.
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 !



Latest comments (113)
Since Postman free plan will archive your collection (community.postman.com/t/how-do-i-g...), this is great way to share the API with the team!! Nice!!
Great extension!! what about streaming data. Does it support websocket?
Wow, will try this out
Great article, I'm only confused about how to set environments. I can't find any guide to set environments (not even in the extension documentation). Can someone help me please???
Hi @crisdan1905 ,
Don't you find more info event under "Environments and custom/system variables support" section in marketplace.visualstudio.com/items... page ?
Jon
Hi Jon, it's just that I hadn't worked with environment variables before on VSCode, so I had no idea how to create an environment file and VSCode documentation about it was a bit confusing to me. Finally, I figured it out in another guide. It may be useful to explain how to create the file in your documentation :)
Great tool by the way, I just loved it and will keep using it
I still love postman. It have some other features too ๐
yes but you do not have the ability to have it into your repo without, each time, export it, and 20 times in a day... it's painful
Love REST client!
Meh, it's just different. Postman is good and it's simply doing its job. I can't see any reason I should migrate.
Very important to be able to integrate API calls like these into your test pipelines -- so does it work-with/replace Newman?
And for those using vim, you can use something like this :
github.com/diepm/vim-rest-console :)
Thanks a lot @hyde_stevenson :)
You're welcome :)