REST Client Open source alternative to Postman

Santosh Hegde
Nggawe Nirman Tech Blog
3 min readOct 6, 2021

REST Client allows you to send HTTP request and view the response in Visual Studio Code directly.

Install REST Client

Open the marketplace extension in VS Code, type “rest client” into the search bar, then install the REST Client as shown in the screenshot below(the author should be Huachao Mao).

Add REST Client extension to VS Code

Set up a REST Client Script

Create a .http file in the root of your project folder.

This step actually sounds more complicated than it actually is. Simply create a file at the root of your project that ends in .http. REST Client recognizes this and knows it’s supposed to be able to run HTTP requests from this file.

Test it out

Make some different routes and run them.

This is the part that’s cool: in my experience this little REST Client plugin was able to do just as much as the more sophisticated API clients like Postman.

Below, I’ll show you to do each type of basic CREATE/GET/UPDATE operation, along with authentication like a x-api-key.

POST Example

The first example I’ll cover is a POST with REST Client, because with my application a user must first register before they can do anything else.

So here’s what that code will look in the sampleData.http file.

POST https://testapi.com/createUser HTTP/1.1
Content-Type: application/json
x-api-key: XXXXXXXXXXXXXXxxxxxxxxxxxxxxxxx
{
"userName": "test",
"userEmail": "test@email.com",
"loginName": "test987",
"password": "uyt876"
}

Response from the server:

GET Example

Now that a user’s been created, let’s say we forgot their password and they send an email to recover it. The email contains a token and a link that will take them to a page to reset their password.

Once they’ve clicked the link and landed on the page, a GET request is fired off to ensure the token included in the email to reset their password is valid, and this is what it might look like.

GET https://testapi.com/test/getUser HTTP/1.1
Content-Type: application/json
x-api-key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The response from the server:

Update Example

Next up is the update. Let’s say the user wants to update something in their profile info. Not hard to do with REST Client either.

PUT https://testapi.com/updateUser HTTP/1.1
Content-Type: application/json
x-api-key: XXXXXXXXXXXXXXxxxxxxxxxxxxxxxxx
{
"userName": "test",
"userEmail": "test@email.com",
"loginName": "test987update",
"password": "uyt876"
}

The response from the server:

And this is really just the tip of the iceberg of what REST Client can do. I covered REST requests and one form of auth, but it can also support GraphQL requests, multiple other types of authentication, environment and custom variables, viewing and saving raw responses and more.

I strongly encourage checking out the documentation to see what all is possible with REST Client; it’s quite robust.

References & Further Resources

--

--