Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am able to connect to Qlik Sense Desktop Engine API using this below python script :
from websocket import create_connection
import json
ws = create_connection("ws://localhost:4848/app/")
data_1=json.dumps({
'jsonrpc': '2.0',
'id': 0,
'method': 'OpenDoc',
'handle': -1,
'params': ['C:\\Users\\sbhowmik\\Documents\\Qlik\\Sense\\Apps\\Converter.qvf']
})
data_2=json.dumps({
'jsonrpc': '2.0',
'id': 5,
'method': 'GetConnections',
'handle': 1,
'params': []
})
print("Sending request 1...")
ws.send(data_1)
print("Sent")
print("Receiving...")
result_1 = ws.recv()
print("Received '%s'" % result_1)
print("Sending request 2...")
ws.send(data_2)
print("Sent")
print("Receiving...")
result_2 = ws.recv()
print("Received '%s'" % result_2)
ws.close()
The message I get in return from engine is as below :
{"jsonrpc":"2.0","method":"OnConnected","params":{"qSessionState":"SESSION_CREATED"}}
{"jsonrpc":"2.0","id":5,"error":{"code":-32602,"parameter":"Invalid handle","message":"Invalid Params"}}
>> Problem Statement : But, the app Test.qvf does not open up AND also, I do not get any QReturn message from the Engine API . I dont understand that why even this Invalid Param message is showing up every time. I maybe doing something wrong here. Please help.
I have not interacted with the API in Python but in javascript, I have to serialize the JSON before sending it:
I too am not much aware about python but I think JSON.dumps(msg) does the same thing as JSON.stringify(msg).
Regards,
Sanchayan Bhowmik