Article

How to check JET(App Studio HTML5 SDK) trust level on your App Studio project

Chavalit Jintamalit
Developer Advocate Developer Advocate

This article is intended for App Providers who develop and manage App Studio project on Eikon App Library.

 

Introduction

JET(App Studio HTML5 SDK) API requires Partner trust level on Eikon Chromium browser.

If the level is Untrusted, JET API calls are blocked. There is an exception only if the URL is localhost or 127.0.0.1 then API calls are still allowed.

This article will go into detail on how to check the JET trust level on your webapp.

 

Prerequisite

You must have Eikon Desktop application installed on your machine.

(optional) Developer permission on your Eikon account.

 

How to launch DevTools on Eikon Chromium browser

Eikon Chromium browser has build-in DevTools which developer or user can use it to debug or track down layout issues and etc...

To launch DevTools on a browser, first, please active the browser you want to bring up DevTools then press "ctrl + shift + J". You should see the window below:

How to check JET trust level on Eikon Chromium browser

1. Launch DevTools on a browser you would like to check the trust level.

2. Go to "Console" tab

3. Type in "JET.ContainerDescription" on the console and press enter.

4. Expand the result object and look for "properties >> 1 >> AppInfo" node.

You should see the JETTrustLevel property with Partner level.

In the case that your JET trust level is Untrusted. You will get an empty AppInfo.

When the JET trust level is Untrusted, JET API calls are blocked and you will not be able to retrieve information using JET API.

Usually this happen from the configuration of app container is incomplete.

Please contact your App Studio Advocate assigned to your project for further assistance.

 

Sample behavior when JET trust level is Untrusted

Here is a sample code which makes JET API calls to retrieve Quote data using Quote plugin.

The sample code is only for demonstrate the capability to make a Quote data subscription on JET API.

    	
            

<!DOCTYPE HTML>

<html>

<head>

<title>Eikon Application</title>

<link rel="stylesheet" type="text/css" href="/webui/css/EikonWebUI.css">

<style type="text/css">

body {

margin: 10px 10px 10px 10px;

}

</style>

<script type="text/javascript" src="/jet2/jet-api/dist/JET.js"></script>

<link rel="import" href="/jet2/jet-app/jet-app.html">

<script type="text/javascript" src="/jet2/jet-plugin-quotes/src/jet-plugin-quotes.js"></script>

<script src="jquery.js"></script>

<script src="jquery-ui.js"></script>

<script src="/select2-4.0.3/dist/js/select2.js"></script>

 

<script type="text/javascript">

 

//define a callback function

var jetReadyCallback = function() {

console.log("JET is loaded and ready to be used");

document.getElementById("outputText").value = "JET is loaded and ready to be used";

}

function onloadHandler() {

//register callback function

JET.onLoad(jetReadyCallback);

//Initialize JET to get it ready for eikon integration

JET.init({

ID:"WebPageID", //Unique ID of your application, can be any string

Title:"My Web Page", //Title that will be showing on the application window

Summary:"A sample page for the JET API", //Any string to describe your app

commandline:true,

});

}

function onUpdate(subscription, ric, updatedValues) {

if (updatedValues["CF_LAST"]) {

document.getElementById("outputArea").value += ("\r\nRIC:"+ric+" CF_LAST:"+updatedValues["CF_LAST"].formatted);

}

if (updatedValues["BID"]) {

document.getElementById("outputArea").value += ("\r\nRIC:"+ric+" BID:"+updatedValues["BID"].formatted);

}

if (updatedValues["ASK"]) {

document.getElementById("outputArea").value += ("\r\nRIC:"+ric+" ASK:"+updatedValues["ASK"].formatted);

}

if (updatedValues["RECORDTYPE"]) {

document.getElementById("outputArea").value += ("\r\nRIC:"+ric+" RECORDTYPE:"+updatedValues["RECORDTYPE"].formatted);

}

document.getElementById("outputArea").scrollTop = document.getElementById("outputArea").scrollHeight;//move to bottom of textarea

}

var subscriptionActive;

function createSubscription(){

document.getElementById("outputArea").value += "Created Subscription!\r\n";

var subscription = JET.Quotes.create();

subscription.rics("JPY=","EUR=","BHP.AX");//multiple RIC is supported

subscription.formattedFields("BID","ASK","CF_LAST","RECORDTYPE");//multiple fields is supported

subscription.onUpdate(onUpdate);//register callback method defined from previous step

subscription.start();

subscriptionActive = subscription;

}

function stopSubscription(){

//document.getElementById("outputArea").value = "";

subscriptionActive.stop();

}

</script>

</head>

<body onload="onloadHandler()">

<input type="text" style="width:250px;" id="outputText"><br/><br/>

<button onClick="createSubscription()">Create Subscription</button><br/><br/>

<button onClick="stopSubscription()">Stop Subscription</button><br/><br/>

<textarea rows="30" cols="50" id="outputArea"></textarea>

<br/>

</body>

</html>

This is the expected behavior when user launchs the sample code page and click on "Create Subscription" on the page.

But if the JET trust level is Untrust, the JET API calls to retrieve Quote data is blocked.

    	
            
function createSubscription(){ document.getElementById("outputArea").value += "Created Subscription!\r\n"; var subscription = JET.Quotes.create(); subscription.rics("JPY=","EUR=","BHP.AX");//multiple RIC is supported subscription.formattedFields("BID","ASK","CF_LAST","RECORDTYPE");//multiple fields is supported subscription.onUpdate(onUpdate);//register callback method defined from previous step subscription.start(); subscriptionActive = subscription; }

And user will see that the JET API does not work properly even the page is loaded successfully.

The webpage is loaded successfully. The JET API is loaded on the page successfully. But JET API cannot make a call to make Quote subscription.

 

(Optional for developer) How to bypass JET trust level requirement during development phase

Eikon Desktop provides tool called "App Studio Web Browser" which always allows JET API calls.

Your Eikon account must have developer access to be able to access this tool.

Please click on Eikon Menu button and look for "Developer" menu. You will only see it if your account has developer access.

You can launch App Studio Web Browser on the Developer menu.

This browser always enforces "Partner" trust level and allows JET API calls. Simply put in your testing website URL on this browser.

Developers are advised to use this tool to test your App Studio webapp during development phase.

Summary

"Partner" trust level is required by Eikon Chromium browser to allow JET API calls.

This article explains a preliminary step to debug App Studio webapp when JET API calls do not work.

For further assistance, please contact your dedicate App Studio Advocate.

 

Reference

Sample code used in this article.