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 !