question

Upvotes
Accepted
1 1 1 2

Side by side api: launched app does not take into account Context

Capture.PNGHello Team,

I am trying to open a news (or quote, or overview) using SXS in python.

Ping and Handhsake work fine but when I launch an app, the app opens, loads but does'nt load the right context (ric)

import pandas as pd
import requests
#ping server
surl='http://127.0.0.1:9000/ping'
r = requests.get(url = surl)
r.text

Output: '9000'

#Handshake
surl='http://127.0.0.1:9000/sxs/v1'
dbody = {'command':'handshake', 
        'productId':pyproductID, 
        'appKey':myappkey}
r = requests.post(url = surl, data = dbody)
response=pd.read_json(r.text)
sessionToken=response['sessionToken'][0]
r.text

Output: json, isSuccess: true

dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'RIC': 'TRI.TO'}]}
        }
r = requests.post(url = surl, data = dbody)
r.text

Output: json, isSuccess: true, got an instance ID


The news app will open and load... the last EIKON opened ric.

Also, is there a way to pass a news ID to the news app (alternatively: what is the best way to open a news from id, using SXS)?

Thank you very much for your answer

BR

PS: could'nt post screen shot (34kb....)???

pythonside-by-side-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@MF - This is a private post

Considering your query, we moved it from the Messenger Side by Side to the Side by Side integration API forum, it seems more appropriate, and will help people discover it.

AHS

Upvote
Accepted
79.2k 251 52 74

@MF

Please try the following code instead.

import json
dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'RIC': 'TRI.TO'}]}
        }
r = requests.post(url = surl, data = json.dumps(dbody), headers={"Content-Type":"application/json"})
r.text

Or,

dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'RIC': 'IBM.N'}]}
        }
r = requests.post(url = surl, json = dbody)
r.text

For StoryId, you can use it with "NewsQuery".

dbody = {'command':'launch', 
        'sessionToken': sessionToken, 
        'appId':'News',
        'context': {"entities": [{'NewsQuery': 'urn:newsml:reuters.com:20191114:nNenT48kC:2'}]}
        }
r = requests.post(url = surl, json = dbody)
r.text
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 1 1 2

Thank you very much Jirapongse,

Just tested your code lines and it works just as expected.

BR
MF

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.