Mastodon Icon GitHub Icon LinkedIn Icon RSS Icon

How VSCode's RestClient saved me from Postman

I do not want to say that Postman is bad because it would be a lie. However, it is not really my favorite piece of software in my tool belt. First, it requires an account. Second, the account subscribed me to a newsletter I totally do not care. Third, it does a lot of things I do not care about on my daily use. Fourth, is a sluggish Electron app that takes forever to do anything.1 And I can go on and on. Maybe for general documentation is good but for development… DEAR GODS, I HATE IT.

At some point, just to avoid Postman I started saving cURL snippets in my snippets’ manager. The fact that I felt relief, and I was more “productive” by browsing a library of command line commands says a lot about Postman.

Anyway, this was not a solution for the long term. At work, I have to develop and maintain an application with a lot of endpoints.

Fortunately, I’ve found the perfect plugin: RestClient.

I like RestClient SO MUCH

RestClient is a wonderful l VSCode extension. The reason I love it is that it is consistent with my “everything is a text file” philosophy. There is no reason (for development) to have weird databases synchronized online in some proprietary system. Let’s just have a plain text file describing the endpoints I need to test and use, and that I can commit into my repository.

So, for example, I now have a folder (called rest-doc) in my project’s root and containing a bunch of .http files that I can use as a perfect replacement for Postman.

Each file contains endpoints and documentation for a specific resource. For instance, imagine I have a book resource. I will create a book.http file with this content:

@testBookId = 12401249912

# Get a Book by ID
GET {{host}}/books/{{testBookId}} HTTP/1.1
Authorization: Bearer {{token}}

# Create a new Book.
POST {{host}}/books/ HTTP/1.1
Authorization: Bearer {{token}}
Content-Type: application/json

	"author": "Some Guy",
	"title": "Some Book"

When I open this file in VSCode, I get all the feature I expect. I can click on a request and run the request directly into VSCode. I can copy a request in cURL format or generate code snippets in different languages. I can do all this and more: just take a look at the official documentation!

As I said, everything is just plain text that I can track and version in the Git repository of the source code. No more accidentally overwritten environment or path variables. No more sync issues. And, most importantly, I do not have to open that bloated piece of software called Postman.

I am much happier now. If you use VSCode and you want to ditch all those obnoxious REST client interfaces, I really recommend taking a look at the RestClient extension.

  1. I have nothing against Electron when the apps are well done like VSCode or Obsidian. Postman is just not one of them. ↩︎

comments powered by Disqus