2018-05-01

If you’ve ever had to work with the SharePoint, MS Graph API’s then you will know that you need to make plenty of REST calls as you’re developing. One point of frustration for me is constantly having to swap to external tools such as Postman to see what response each REST call returns.

To make my life easier I wanted to find a tool that would allow me to the check the REST response within the VSCode editor, without switching between different tools.

Welcome to the REST Client extension which is available in the Visual Studio Marketplace.

Amongst other benefits, the REST Client extension allows you to fire off a request from within the VSCode editor.

Here’s how to get it working …

Get the Azure AD Domain:

  1. Note down the Azure AD domain as mentioned below from the Azure portal screen.

Install the Rest Client extension:

 

Create a new file (*.http):

Create a request section for each api with the Authorization Header as below.

# @name getclientsidewebparts
GET https://sktechnologies.sharepoint.com/_api/web/getclientsidewebparts HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: {{$aadToken sktechnologiesltd.co.uk}}

###

# @name get user 
GET https://graph.microsoft.com/v1.0/users/kshsbala@sktechnologies.onmicrosoft.com/ HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: {{$aadToken sktechnologiesltd.co.uk}}

###

Send Request:

  • Execute the request using the “Send Request” option.

Sign In to get the response:

Follow the login sequence and the response will be displayed as below.

More details of the RestClient can be found here.

About the author 

Balamurugan Kailasam