In my view, Postman has become bloated, and its UI layout and hierarchy are confusing. But perhaps if you have tons of endpoints to manage, it’s still the best tool of its kind out there. Otherwise, I would like to introduce you a way you can easily manage and make API calls in Visual Studio Code!

The tool that makes this all possible is a VSCode extension called REST Client. So go ahead and install it and let me share with you what I have learnt so far with it! 😃

First off, two quick things to get you going:

  1. Open a new editor.
  2. Change the language mode to http — press ctrl+shift+p , search Change Language Mode and select http .

Now we can start writing some API calls.

REST Client supports custom variables that are prefixed with a @ . Variables are great for things we use often and everywhere, which in this case they are your access_token , api_credential , and base_url .

To use a custom variable, you just need to enclose it with a pair of double curly brackets like so {{custom_variable}} . We will see this in action below.

REST Client supports constructing API calls written in the standard of curl and RFC 2616 (don’t worry as you will see in a bit it’s very self-explanatory!). Let’s see what each of those might look like in practice. 🙆

cURL

You can write it out yourself, or if you already have APIs being called in your browser, you can easily copy and paste them as cURL. Here is how you copy in Chrome. Although Firefox has similar feature and steps to achieve it, it currently has a bug being resolved.

#visual-studio-code #api #postman

You Might not Need Postman if you use Visual Studio Code
19.85 GEEK