SharePoint REST Client makes it easy for you to test SharePoint REST API inside VSCode.
SP REST Client built on top of awesome REST Client created by Huachao Mao.
Thus SP REST Client implements all features from REST Client and adds convenient silent SharePoint authentication layer. SP REST Client introduced some architecture and performance changes making it impossible to properly merge with REST Client, that's why separate add-in was created.
NOTE: There might be issues when running both REST Client and SP REST Client at the same time. It's recommended to install only one of them.
For all REST Client features please refer to the original REST Client docs.
This readme describes how to setup SP REST Client to work with SharePoint.
In order to successfully run REST queries against SharePoint, you need to configure your authentication data. All authentication data is stored inside .json files. SP REST Client is implemented using node-sp-auth module, thus supports various authentication scenarios.
Below are the configuration steps required:
Generate a file with your credentials. For that purpose you need node-sp-auth-config CLI.
Install CLI by running
npm install node-sp-auth-config -g
In your working folder run
sp-auth init -p <path to your .json file with credentials>
Follow instructions and generate a file with your credentials data.
In VSCode open Workspace Settings. Add a new environment, give it a name, say default. Add a new variable to your default environment called sp-auth. Put a path to your .json file with credentials generated at step #1 as value for sp-auth variable. If your file is stored inside your workspace, you should put workspace-relative path. However you can also put absolute path to the file.
Open your .http or .rest file and change your active environment to default (Ctrl+Alt+E (Cmd+Alt+E for macOS), or press F1 and then select/type Rest Client: Switch Environment), or click on active environment in the right bottom area of VSCode (by default No Environemnt should be displayed). Read more here about language support and file associations.
You're ready to run your REST query. For your REST API requests use the same url you provided under credentials configuration.