Scott Hanselman

Exploring the Visual Studio Code REST Book extension for native Notebooks

May 13, 2021 Comment on this post [3] Posted in Open Source
Sponsored By

My co-worker Tanha Kabir has a cool Visual Studio Code extension called REST Book. Sure, there's lots of extensions and lots of ways to call REST APIs from Visual Studio Code - not to mention the command line.

However, REST Book is a Postman-like notebook that uses the Native Notebooks UI experience that's already built into Visual Studio code.

If you already love the concept of Notebooks like I do, you'll love REST Book. It's electric paper! Just like .NET Interactive or Jupyter Notebooks, it mixes Prose and Code in a very clean and very intuitive interface.

NOTE: Today the REST Book extension requires Visual Studio Code Insiders, but not for long. Get Insiders and run it side-by-side with a stable VS Code here.

Here's me calling into my Nightscout server to see my real-time Blood Glucose:

Nightscout in REST Book

Pretty cool. It's early days but I think Tanha already has a very interesting combination of a native Notebook experience and a Postman-like experience. Note I've also created a "SECRET" in the form of my API Key, and then I can refer to it in the GET request using $

You can also assign variables like:

let foo = GET

and then use them in subsequent cells with $.foo.headers.User-Agent, etc.

Just install the Rest Book extension in VS Code Insiders, and make a new empty text file with a .restbook extension.

You can do GET and have the URL on multiple lines if you split on a ? or &

User-Agent: rest-book
Content-Type: application/json

And you can POST and each new line will be a Header, until the last lines after a line separator which is the body of the call.

User-Agent: rest-book
Content-Type: application/json

name: "Hello",
text: "Hi friends, how are you all?"

If you want to get involved, look at the source, file an issue or bug, or just give compliments, do it over on her repository at Have fun!

Sponsor: The No. 1 reason developers choose Couchbase? You can use your existing SQL++ skills to easily query and access JSON. That’s more power and flexibility with less training. Learn more.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
May 18, 2021 11:52
Interesting as always. Is the $SECRETS part of the notebook functionality or external to it? How you handle secrets in VS Code might make a nice blog post for someone skilled in the craft ;-)
May 18, 2021 17:32
Agree with Dave - Secrets are always the tricky bit. And can you chain calls together (i.e. OAuth token retrieval?).
May 19, 2021 12:30
It's very useful extension. I've used it for last couple of days and I like it a lot. Thanks for recommending it.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.