How to test REST API with Visual Studio Code — REST Client extensions

Wasin Waeosri
Jan 4 · 8 min read


Visual Studio Code (or just VSCode) is a free source code editor developed and maintained by Microsoft. This cross-platform editor took over developers’ popularity based on its fast and lightweight, supports a variety of programming languages with IntelliSense (a feature that borrows from its sibling, Visual Studio IDE), and supports complete development operations like debugging, task running, and version control.

VSCode also supports a lot of extensions that extend the editor features and development workflow such as code linters or add new language support, etc. One of the most recent extension is REST Client allows developers to send HTTP request and view the response message in VSCode directly.

This article demonstrates how to use the REST Client extension in VSCode by using Refinitiv Data Platform (RDP) APIs as an example HTTP REST API. Developers who currently use VSCode to implement the RDP APIs application (with any languages) can use this extension to test the RDP APIs query, endpoint without a switch to other tools like Postman or cURL.

Note: RDP APIs developers still need RDP APIs Playground page to get the APIs document and information.

What is Refinitiv Data Platform (RDP) APIs?

The Refinitiv Data Platform (RDP) APIs provide various Refinitiv data and content for developers via easy to use Web-based API.

RDP APIs give developers seamless and holistic access to all of Refinitiv content such as Historical Pricing, Environmental Social and Governance (ESG), News, Research, etc and commingled with their content, enriching, integrating, and distributing the data through a single interface, delivered wherever they need it. The RDP APIs delivery mechanisms are the following:

  • Request — Response: RESTful web service (HTTP GET, POST, PUT or DELETE)
  • Alert: delivery is a mechanism to receive asynchronous updates (alerts) to a subscription.
  • Bulks: deliver substantial payloads, like the end of day pricing data for the whole venue.
  • Streaming: deliver real-time delivery of messages.

This article is focusing on the Request-Response: RESTful web service delivery method only.

For more detail regarding Refinitiv Data Platform, please see the Quick Start and Tutorials pages.

RDP APIs Application Workflow

Refinitiv Data Platform entitlement check is based on OAuth 2.0 specification. The first step of an application workflow is to get a token from RDP Auth Service, which will allow access to the protected resource, i.e. data REST API’s.

Next, after the application received the Access Token (an authorization token) from RDP Auth Service, all subsequent REST API calls will use this token to get the data. The application needs to input Access Token via Authorization HTTP request message header as shown below.

  • Header: Authorization = Bearer <RDP Access Token>

Please notice the space between the Bearer and RDP Access Token values.

Please find more detail regarding RDP APIs workflow in Introduction to the Request-Response API page.

VSCode REST Client Syntax

The REST Client plugin requires just a plain text file with the extension .http or .rest. The basic syntax is very simple as following

The file can contain multiple requests, each request is separated by ### delimiter (three or more consecutive #).

Request Line

The first line of the request is the Request Line. It contains the request method (GET or POST), space, and then followed by the API URL endpoint.




Request Line: Query Parameters

You can set the API query parameters into API URL directly as follows:

If the request contains multiple parameters, you can split it into multiple lines. The REST Client extensions parse the lines immediately after the Request Line which starts with ? and & operations.

Request Header

The lines immediately after the Request Line are Request Header. The supported syntax is the field-name: field-value format, each line represents one header. The Authentication also can be set in this Request Header section.


You can declare your File variables to keep the values and reuse them in the script such as API base endpoint, version with @variableName = variableValue syntax in a separate line from request block. Then the request can use the defined variable with {{variableName}} syntax. Please note that you do not need the "" or '' characters for a string value.


The extension will parse the above Request Lines to and endpoints.

Note: the variable name must not contain any spaces.

Variables: Request Variables

You can declare Request Variables to get a request or response message content. The syntax is just # @name requestName on a line before the Request Line. Once the request is sent, the script can access response (or request) message information from {{requestName.(response|request).(body|headers).(*|JSONPath|XPath|Header Name)}} syntax.

This feature is mandatory for RDP APIs because the consumer needs to get a token from RDP Auth Service first, then use that token to request further protected resources from the platform.

The example above named RDP Auth Service request with rdpAuth name, then gets access token from {{rdpAuth.response.body.$.access_token}} command and set it to variable name accessToken. Then set this access token to the request message Authentication in all subsequent RDP APIs requests with Authorization: Bearer {{accessToken}} Request header syntax.

For the full detail and explanation of RDP Authentication process application workflow, please refer to the following RDP APIS tutorials:

Request Body

The Request Body can be set by adding a blank line after Request Header and then place your HTTP request data in the next line. The request data can be various types of format such as JSON, XML, or key-value tuples.

One example is the RDP Auth Service which use application/x-www-form-urlencoded Content-Type. This content-type uses key-value tuples separated by &, with a = between the key and the value.

Example for application/json Content-Type:

For more detail regarding the REST Client extension syntax and features, please see the VSCode: REST Client product page.

Demo Applications Prerequisite

The demo project is available on GitHub. The project requires the following dependencies software.

  1. RDP Access credentials.
  2. Visual Studio Code editor.
  3. VSCode: REST Client extension.
  4. Internet connection.

Please contact your Refinitiv’s representative to help you to access Refinitiv Data Platform credentials. You can generate/manage the AppKey from AppKeyGenerator web site or AppKey Generator tool in Eikon Desktop/Refinitiv Workspace application.

VSCode REST Client and Project Setup

Once you have unzipped or downloaded the example project folder into a directory of your choice, you can setup the VSCode REST Client extension and project prerequisite by the following steps.

Firstly, open VSCode and click Extensions button, then search the REST Client extension and click install it.

REST Client extension
REST Client extension

Next, create a file name .env in the example folder and input your RDP credentials with the following message format.

Please note that you do not need the "" or '' characters for a string value as the following example:

Now the VSCode editor is ready to request data from RDP REST APIs.

How to run the example

Once you have completed setup VSCode and .env file, open the in fileexample folder with VSCode editor. Then click the Send Request link above the request or use shortcut Ctrl+Alt+R (Cmd+Alt+R for macOS) to send the HTTP request message. For RDP APIs, the first request message is always an authentication request message.

Send RDP Auth Service request
Send RDP Auth Service request

The HTTP response message will show in a separate webview panel of VSCode editor.

Receive RDP Auth Service response
Receive RDP Auth Service response

Once the file receives RDP Auth Service response message, it keeps RDP access token to the script variable via @accessToken = {{rdpAuth.response.body.$.access_token}} command. Then you can request further RDP content in file.

Send RDP ESG request
Send RDP ESG request

Then get the response.

Receive RDP ESG response
Receive RDP ESG response

You can also select an interesting HTTP request and generate the source code for that request in various programming languages by shortcut Ctrl+Alt+C (Cmd+Alt+C for macOS).


You may think “why would I bother to use this extension when I already have a Postman”. The Postman is a complete platform for API testing and development so it has many more features than this extension. However, this VSCode: REST Client extension lets developers who are using this editor do a quick REST API test call such as test various API query parameters, test new Service URL, or test different credentials in the same tool that they are developing the application. Developers do not need to switch a tool for a quick REST API query test anymore.

This extension helps any REST APIs developers with Visual Studio Code to implement application a smooth and seamless workflow.


For further details, please check out the following resources:

For any question related to Refinitiv Data Platform, please use the Developers Community Q&A Forum.


Refinitiv Developer Community

Connecting developers across the globe

Refinitiv Developer Community

At Refinitiv, an LSEG (London Stock Exchange Group) business, we believe data is just the beginning™. Learn how to work with data from Refinitiv and be more effective when working with Refinitiv APIs. Ask Questions and discuss ideas with our experts and Community.

Wasin Waeosri

Written by

Developer Advocate at Refinitiv, an LSEG business.

Refinitiv Developer Community

At Refinitiv, an LSEG (London Stock Exchange Group) business, we believe data is just the beginning™. Learn how to work with data from Refinitiv and be more effective when working with Refinitiv APIs. Ask Questions and discuss ideas with our experts and Community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store