Global Directory
Global Directory
EXPLORE OUR SITES
London Stock Exchange Group
LSEG Data & Analytics
MyAccount
LSEG Perspectives
London Stock Exchange
FTSE Russell
LCH
Contact Us
Home
TR Internal
How to successfully call JET.news.createTopNews?
Binglin Yu
I can't get a successful return by calling JET.news.createTopNews, after going through the jet help doc.
Could someone please provide an workable example?
Thanks.
Find more posts tagged with
eikon
refinitiv-internal
Accepted answers
All comments
Jirapongse
I can make it work. I subscribed to all URN IDs mentioned in
https://thehub.thomsonreuters.com/docs/DOC-559026?utm_medium=search&utm_source=full
. However, the update is fired infrequently. The following is a javacript code. You need to try to add all URNs in the excel sheet to topnewsid variable.
var subscription;
var topnewsid = [
"urn:newsml:reuters.com:20020923:SPDOC_119827232002",
"urn:newsml:reuters.com:20020924:SPDOC_55977242002",
"urn:newsml:reuters.com:20020924:SPDOC_55994242002",
...
...]
JET.onLoad(function () {
console.log("JET is Ready");
// Creates a new subscription
subscription = JET.News.createTopNews()
// Sets necessary ids. You can also pass an array of string to the "ids" method
.ids(topnewsid)
// Sets update handler. Two values are passed to the callback:
// id of the top news, and top news version number
.onUpdate(function (id, ver) {
console.log("onupdate: " + id + "; ver = " + ver);
})
// Start the subscription
.start();
console.log("Start Subscription");
});
window.onload = function () {
JET.init({ ID: "WebPageID", Title: "My Web Page", Summary: "A sample page for the JET API" });
}
The following is an output from chorme console:
JET is Ready newsapp.js:55
Start Subscription newsapp.js:71
onupdate: urn:newsml:reuters.com:20020924:SPDOC_56007242002; ver = 105366 newsapp.js:66
onupdate: urn:newsml:reuters.com:20030314:SPDOC_75426142003; ver = 71902 newsapp.js:66
onupdate: urn:newsml:reuters.com:20020924:SPDOC_55977242002; ver = 184701 newsapp.js:66
onupdate: urn:newsml:reuters.com:20020924:SPDOC_55977242002; ver = 184702 newsapp.js:66
onupdate: urn:newsml:reuters.com:20110405:SPDOC_1577840520111; ver = 20546 newsapp.js:66
onupdate: urn:newsml:reuters.com:20020923:SPDOC_119827232002; ver = 367680 newsapp.js:66
onupdate: urn:newsml:reuters.com:20020924:SPDOC_55977242002; ver = 184703 newsapp.js:66
onupdate: urn:newsml:reuters.com:20020924:SPDOC_55994242002; ver = 100628 newsapp.js:66
onupdate: urn:newsml:reuters.com:20110214:SPDOC_1568591420111; ver = 27780 newsapp.js:66
Quick Links
All Forums
Recent Questions
Terms of use
Privacy & Cookie Statement
Cookies settings
Do not sell my info
Whistleblowing
UK Bribery Act
Modern Slavery Act