These two plugins might come in handy if you are a developer or consumer of web APIs (e.g. REST).

They allow you to send requests to your API and receive responses without leaving your editor. You can quickly explore APIs while saving your calls along the way as simple text file for documentation and sharing. They might supplement or replace tools like curl or Postman in your workflow.

Clean and easy requests

With both plugins, you write your API request as text block in your editor and sent it to your API endpoint on demand. The response then shows up in a new editor buffer/window.

You can write multiple request blocks in the same file and send them separately on demand.

Save the file for later reference and share it with others as an example.

The syntax for the two plugins is slightly different. You cannot use a Vim request block directly with VS Code. But it is straightforward to adjust the request block to make it work.

To send requests

  1. Type in a request block.

  2. Place the cursor anywhere within the block.

  3. Hit the trigger key to send the request (default: CTRL-J).

Vim ./example.rest
# vim: set filetype=rest

# global curl options
--silent
--include
--

# GET
https://reqres.in
GET /api/users/2

# POST
https://reqres.in
POST /api/users
{
    "name": "andreas",
    "job": "consultant"
}

# DELETE
https://reqres.in
DELETE /api/users/2

Tip

You can add query parameters like so:

https://reqres.in
GET /api/users?per_page=2&page=4

Or you can write the same request like this for better readability:

https://reqres.in
GET /api/users
per_page=2
page=4

If your query parameters are more complex, you may be required to enable the Line-by-line Request Body option for the Vim plugin when your query does not work otherwise.

Complex query:
https://localhost:8001
GET /api/content/search
limit=10
cql=(type=page and space=IT and label=infrastructure)
Vim plugin option:
:let b:vrc_split_request_body = 1