Workspace Web Integration Capabilities

Overview

This document helps you to get started quickly with the Refinitiv Workspace Web Integration Capability. By following this short tutorial, you will learn how to use the Workspace Side by Side API and the Refinitiv Data Platform Library for TypeScript in the same web application. These two libraries are the main components of the Refinitiv Workspace Web Integration Capability. They enable your application to interact with Refinitiv Workspace for Web and to access data and services of the Refinitiv Data Platform. More specifically, this tutorial will show you how you can use these libraries to convert an ISIN (International Securities Identification Number) into a RIC (Reuters Instrument Code), and then how to display related information by starting programmatically the Company Overview application of Refinitiv Workspace.

Prerequisites

1.    Install the nodejs and npm package manager from https://www.nodejs.org

2.    Install the http-server NPM package by running npm install --global http-server

Steps

Step 1: Prepare sources

1.    Download the archive quickstart-rdp-lib-ts-js.zip

2.   Unzip it and you will see two folders inside of it: browser and node-developing

Step 2: Write the code

1.    Create a folder called rdp-lib-test,

2.    Copy extracted browser/refinitiv-dataplatform-containersession.js file to the rdp-lib-test folder

3.    Create index.html file within this folder

4.    Paste the following code into index.html

Note: the index.html file has already been added to the browser folder in the archive, so that you can simply move it to the rdp-lib-test folder instead of creating a new one.

Example Code

    	
            

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8" />

    <title>RDP Library Typescript</title>

</head>

<body>

    <div id='info'>Loading Side by Side Web and the RDP library...</div>

    <noscript>You need to enable JavaScript to run this sample</noscript>

    <script src="https://cdn.refinitiv.com/public/libs/sxs-web/sxs-web-loader.js"></script>

    <script src="http://localhost:8080/refinitiv-dataplatform-containersession.js"></script>

    <script>

        function progress(msg){

            document.getElementById('info').innerHTML += "<br/>" + msg;

        }

        window.SxsWeb = window.SxsWeb || [];

        window.sxsWeb = window.sxsWeb || function () {

            SxsWeb.push(arguments);

        };

        

        const { ContainerSession, SymbolConversion } = window['@refinitiv/dataplatform-containersession'];

        

        const sxs = window.sxsWeb;

        

        // For users, who use a private network

        // sxs("config", "use-network", "private");

        

        progress("Starting Side by Side Web, please wait...");

        sxs.start(new Date());

        sxs.onLoad(async () => {

            progress(".... => Side by Side Web is ready.");

            console.log('Side by Side Web Loaded at time: ' + new Date());

            

            progress("Creating RDP library session...");

            const dataSession = ContainerSession.Definition({

                appKey: 'e5dec0df56b544a4a058b425a3634ba9f0d25041',

                bus: sxs

            }).getSession();

            

            try {

                

                progress("Opening RDP library session...");

                await dataSession.open();

                

                const isin = 'US4592001014';

                progress("Converting ISIN=" + isin + " to RIC...");

                const symbologyDefinition = SymbolConversion.Definition({

                    symbols: isin,

                    fromSymbolType: SymbolConversion.SymbolType.ISIN,

                    toSymbolType: [

                        SymbolConversion.SymbolType.RIC,

                    ],

                });

                

                const symbologyResponse = await symbologyDefinition.getData(dataSession);

                

                const ric = symbologyResponse.data.raw.Matches[isin].RIC;

                progress(".... => Conversion result RIC = " + ric);

                progress("Opening Company Overview page for '" + ric + "'");

                sxs.navigate(sxs.AppLibrary.OV, sxs.Context.ric(ric), 'tab');

            } catch (e) {

                console.log(e);

            } finally {

                await dataSession.close();

            }

        });

    </script>

</body>

</html>

Note: If you are using a private network, you should ensure that you uncomment the following line:

    	
            sxsWeb("config", "use-network", "private");
        
        
    

Step 3: Build

Save the file, and run the command http-server in the sxs-web-test folder.

Step 4: Run

1.    Open Google Chrome and run Refinitiv Workspace Web in it. Make sure you have logged in

2.     In the browser, navigate to http://localhost:8080/index.html and open Dev Tools

Step 5: Verify

1.    Navigate to the Console tab of the Dev Tools window and confirm that the Sxs Web is loaded! message has appeared

2.   Make sure that settings in your browser do not block pop-ups from automatically showing up on your screen

3.   The following messages that indicate stages of code execution will be displayed on the page:

- Loading Side by Side Web and the RDP library...

- Starting Side by Side Web, please wait...

- Side by Side Web is ready.

- Creating RDP library session...

- Opening RDP library session...

- Converting ISIN = " ISIN " to RIC...

- Conversion result RIC = 

- Opening Company Overview page for " RIC ".

4.  The new tab with Company Overview application will be open within Refinitiv Workspace Web

Note: If you see the message Uncaught Error: Could not load Side By Side Web, error: not authorized, you must first log in to Refinitiv Workspace Web in the same browser before trying again

Example package

The full code example is available here for download