Quantcast
Channel: Scott Hanselman's Blog
Viewing all articles
Browse latest Browse all 1148

Exploring the Visual Studio Code REST Book extension for native Notebooks

$
0
0

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 $SECRETS.name.

You can also assign variables like:

let foo = GET https://hanselman.com

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

Just install the Rest Book extesnion 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 &

GET https://www.google.com

?query="hanselman"
&page=2
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.

POST https://www.myexampleapi.com

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 https://github.com/tanhakabir/rest-book 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.



© 2021 Scott Hanselman. All rights reserved.
    

Viewing all articles
Browse latest Browse all 1148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>