<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Qlik Sense: call Qlik Sense Engine API with Python in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/ta-p/1716089</link>
    <description>&lt;P&gt;This is a Python example to call the Qlik Sense Engine API.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Here is a simple script using the websocket-client module to call the Engine API. Note that the Qlik Sense virtual proxy is set to header authentication.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;import websocket
import ssl
import json

header_user = {'header_user': 'user1'}

ws = websocket.create_connection("wss://qlikserver1.domain.local/hdr/app/", sslopt={"cert_reqs": ssl.CERT_NONE},header=header_user)

ws.send(json.dumps({
	"handle": -1,
	"method": "GetDocList",
	"params": [],
	"outKey": -1,
	"id": 1
}))

result = ws.recv()

while result:
    result=ws.recv()
    y = json.loads(result)
    print(y)

ws.close()&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;Example of results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;{'jsonrpc': '2.0', 'method': 'OnConnected', 'params': {'qSessionState': 'SESSION_CREATED'}}
{'jsonrpc': '2.0', 'id': 1, 'result': {'qDocList': [{'qDocName': 'test1', 'qConnectedUsers': 0, 'qFileTime': 0,
 'qFileSize': 176418, 'qDocId': '9b428869-0fba-4ba5-9f94-901ae2fdf041', 'qMeta': {'createdDate': '2018-11-29T09:28:40.588Z', 
'modifiedDate': '2018-12-17T15:13:56.860Z', 'published': True, 'publishTime': '2018-12-17T15:13:56.782Z', 
'privileges': ['read', 'offlineaccess'], 'description': '', 'dynamicColor': '', 'create': None, 'stream': {'id': 
'aaec8d41-5201-43ab-809f-3063750dfafd', 'name': 'Everyone'}, 'canCreateDataConnections': False}, 'qLastReloadTime': 
'2018-11-29T09:30:42.121Z', 'qTitle': 'test1', 'qThumbnail': {}}]}}&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 09:08:26 GMT</pubDate>
    <dc:creator>Damien_V</dc:creator>
    <dc:date>2021-02-23T09:08:26Z</dc:date>
    <item>
      <title>Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/ta-p/1716089</link>
      <description>&lt;P&gt;This is a Python example to call the Qlik Sense Engine API.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Here is a simple script using the websocket-client module to call the Engine API. Note that the Qlik Sense virtual proxy is set to header authentication.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;import websocket
import ssl
import json

header_user = {'header_user': 'user1'}

ws = websocket.create_connection("wss://qlikserver1.domain.local/hdr/app/", sslopt={"cert_reqs": ssl.CERT_NONE},header=header_user)

ws.send(json.dumps({
	"handle": -1,
	"method": "GetDocList",
	"params": [],
	"outKey": -1,
	"id": 1
}))

result = ws.recv()

while result:
    result=ws.recv()
    y = json.loads(result)
    print(y)

ws.close()&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000;"&gt;Example of results:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE class="ckeditor_codeblock"&gt;{'jsonrpc': '2.0', 'method': 'OnConnected', 'params': {'qSessionState': 'SESSION_CREATED'}}
{'jsonrpc': '2.0', 'id': 1, 'result': {'qDocList': [{'qDocName': 'test1', 'qConnectedUsers': 0, 'qFileTime': 0,
 'qFileSize': 176418, 'qDocId': '9b428869-0fba-4ba5-9f94-901ae2fdf041', 'qMeta': {'createdDate': '2018-11-29T09:28:40.588Z', 
'modifiedDate': '2018-12-17T15:13:56.860Z', 'published': True, 'publishTime': '2018-12-17T15:13:56.782Z', 
'privileges': ['read', 'offlineaccess'], 'description': '', 'dynamicColor': '', 'create': None, 'stream': {'id': 
'aaec8d41-5201-43ab-809f-3063750dfafd', 'name': 'Everyone'}, 'canCreateDataConnections': False}, 'qLastReloadTime': 
'2018-11-29T09:30:42.121Z', 'qTitle': 'test1', 'qThumbnail': {}}]}}&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 09:08:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/ta-p/1716089</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2021-02-23T09:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1719669#M222</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;, hi!&lt;/P&gt;&lt;P&gt;Tell me, please, when I try to use this code for myself, I encounter an authorization problem. Can you tell me how to specify a username and password for authorization when using the Qlik Engine API.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 13:43:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1719669#M222</guid>
      <dc:creator>g_bolshakov</dc:creator>
      <dc:date>2020-06-17T13:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1719688#M223</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/37923"&gt;@g_bolshakov&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code sample is using header authentication, so you need to create a virtual proxy in the QMC that is using header authentication.&lt;/P&gt;&lt;P&gt;header authentication is not secure if not used in combination with an external proxy/reverse proxy that would limit which end user is allowed to send the header to Qlik Sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would recommend you use JWT authentication, it's simple to set up and more secure.&lt;/P&gt;&lt;DIV class="knowledgeTOCRenderer-body"&gt;&lt;DIV&gt;&lt;DIV class="pbSubsection"&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;&lt;A href="https://support.qlik.com/articles/000034966" target="_blank" rel="noopener"&gt;https://support.qlik.com/articles/000034966&lt;/A&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="knowledgeTOCRenderer-body"&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Then just update this line:&lt;/P&gt;&lt;PRE&gt;header_user = {'header_user': 'user1'}&lt;/PRE&gt;&lt;P&gt;to&lt;/P&gt;&lt;PRE&gt;header_user = {'Authorization': 'Bearer (your jwt token)'}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can generate a test JWT token from &lt;A href="https://jwt.io" target="_blank" rel="noopener"&gt;https://jwt.io&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2020 14:00:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1719688#M223</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2020-06-17T14:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1761329#M1091</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/37923"&gt;@g_bolshakov&lt;/a&gt;&amp;nbsp;, did you find how to authenticate with a username and password? I am also struggling with this. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 20:28:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1761329#M1091</guid>
      <dc:creator>ricardolsmendes</dc:creator>
      <dc:date>2020-11-12T20:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1762292#M1123</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/129597"&gt;@ricardolsmendes&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean username and password for Windows credentials, then it's not possible directly as the Engine API websocket cannot handle Windows authentication directly.&lt;/P&gt;
&lt;P&gt;You would need to rebuild one part of the authentication workflow in your code, validate Windows credentials and issue a ticket by calling the Qlik Proxy API for example.&lt;/P&gt;
&lt;P&gt;Or you can use JWT authentication as previously suggested, still that you would be up to you to validate user credentials within your code upfront before injecting the JWT token.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 15:01:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1762292#M1123</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2020-11-17T15:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1762339#M1124</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've managed to rebuild part of the authentication workflow,&amp;nbsp;&lt;SPAN&gt;issuing a ticket by calling the Qlik Proxy API for example, as you mentioned.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 18:24:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1762339#M1124</guid>
      <dc:creator>ricardolsmendes</dc:creator>
      <dc:date>2020-11-17T18:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1770065#M1349</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;This get information about an app, but is there a way to receive a result from a app, like example, execute it and get the result ?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 20:05:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1770065#M1349</guid>
      <dc:creator>eduardo_dimperio</dc:creator>
      <dc:date>2020-12-22T20:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1774607#M1434</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;, thank you for this!&amp;nbsp; I've been able to get it connect.&amp;nbsp; Is there any documentation or examples that you might point me to better understand how to actually query and instantiate different objects?&amp;nbsp; For example, when I use the Engine Explorer, I can call different methods tied to different objects (App, sheet, or data table, for example).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't yet understand how I can (or if I need to) instantiate these different objects to then query for children, and ultimately run an exportData on the data table.&amp;nbsp; Any materials you could point me to for further learning would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Geoff&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 21:49:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1774607#M1434</guid>
      <dc:creator>beatYesterday</dc:creator>
      <dc:date>2021-01-14T21:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1774698#M1437</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/21319"&gt;@eduardo_dimperio&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe what you are searching for is EvaluateEx() ?&lt;BR /&gt;It will evaluate an expression in the app and return the result&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/November2020/APIs/EngineAPI/services-Doc-EvaluateEx.html" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/November2020/APIs/EngineAPI/services-Doc-EvaluateEx.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 10:09:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1774698#M1437</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2021-01-15T10:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1774699#M1438</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/131629"&gt;@beatYesterday&lt;/a&gt;&amp;nbsp;When you open/instantiate an app or an object, it will return a handle (check the "qHandle" parameter in the response of the request to know the number)&lt;/P&gt;
&lt;P&gt;You will need to use the handle number in your new request to indicate which object you want to query.&lt;/P&gt;
&lt;P&gt;The handle for the global interface where you can create/open app is always -1, but the other handles will vary based on the order in which you have opened the different objects.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 10:11:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1774699#M1438</guid>
      <dc:creator>Damien_V</dc:creator>
      <dc:date>2021-01-15T10:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1776513#M1531</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29425"&gt;@Damien_V&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do exactly as you recommend, use WS to connect and product ExportData object, and then navigate to the csv temp location via a get request in Python.&amp;nbsp; However, when I try to navigate to the file location I am prompted to enter in the credentials, even though I'm sending the request(I think) to use the certificates.&amp;nbsp; I have also tried using the Session API to generate a new sesssionID via POST request, and then use that SessionID with a subsequent GET&amp;nbsp; request to the csv file.&lt;/P&gt;&lt;P&gt;I have verified that a user session is being created on the Qlik server with the POST request, but the GET request for the file still redirects to the login page.&amp;nbsp; Below is the code I'm using for this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;createSessionURL = "https://host/qps/session?xrfkey=1234567890123457"

postHeaders={   "X-Qlik-User": "UserDirectory=&amp;lt;DIRECTORY&amp;gt;;UserId=&amp;lt;USER&amp;gt;",
            "X-Qlik-XrfKey": "1234567890123457",
            "COntent-type":"application/json"
        }

body ="""
{
  "UserDirectory": "&amp;lt;DIRECTORY&amp;gt;",
  "UserId": "&amp;lt;USER&amp;gt;",
  "Attributes": [ ],
  "SessionId": "11111111"
}
"""


#use created session ID to get output of Engine API exportData function
r = requests.post(createSessionURL, headers= postHeaders, cert =(pemPath,pemKeyPath), verify=False, allow_redirects=True, data=body)

#set headers
getHeaders = {   "X-Qlik-User": "UserDirectory=&amp;lt;DIRECTORY&amp;gt;;UserId=&amp;lt;USER&amp;gt;",
            "X-Qlik-XrfKey": "1234567890123457",
            "X-Qlik-Session": "11111111"
        }


csvURL = "https://host/tempcontent/&amp;lt;randomlyGeneratedPath&amp;gt;.csv?serverNodeId=&amp;lt;SERVERNODE&amp;gt;&amp;amp;xrfkey=1234567890123457'

#make call for file
r2 = requests.get(csvURL, headers= getHeaders, cert =(pemPath,pemKeyPath), verify=False, allow_redirects=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for your assistance and guidance,&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 22:08:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1776513#M1531</guid>
      <dc:creator>beatYesterday</dc:creator>
      <dc:date>2021-01-21T22:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1776745#M1537</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;After further research and trial and error I was able to figure out how to do this.&amp;nbsp; I'm adding the general code of how I did this below for others' reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;createSessionURL = "https://host/qps/session?xrfkey=1234567890123457"

postHeaders={   "X-Qlik-User": "UserDirectory=&amp;lt;DIRECTORY&amp;gt;;UserId=&amp;lt;USER&amp;gt;",
            "X-Qlik-XrfKey": "1234567890123457",
            "Content-type":"application/json"
        }

body ="""
{
  "UserDirectory": "&amp;lt;DIRECTORY&amp;gt;",
  "UserId": "&amp;lt;USER&amp;gt;",
  "Attributes": [ ],
  "SessionId": "11111111"
}
"""

#CREATE A SESSION OBJECT
s = requests.Session()

#use created session ID to get output of Engine API exportData function, this returns a session object with the sessionID you define
r = s.post(createSessionURL, headers= postHeaders, cert =(pemPath,pemKeyPath), verify=False, allow_redirects=True, data=body)

#set headers
getHeaders = {   "X-Qlik-User": "UserDirectory=&amp;lt;DIRECTORY&amp;gt;;UserId=&amp;lt;USER&amp;gt;",
            "X-Qlik-XrfKey": "1234567890123457",
            "X-Qlik-Session": "11111111"
        }

csvURL = "https://host/tempcontent/&amp;lt;randomlyGeneratedPath&amp;gt;.csv?serverNodeId=&amp;lt;SERVERNODE&amp;gt;&amp;amp;xrfkey=1234567890123457'

#set Qlik Session Cookie with the same sessionID defined in post requests
s.cookies.set("X-Qlik-Session", '11111111', domain = &amp;lt;qlikHostDomain&amp;gt;)

#make call for file
r2 = s.get(csvURL, headers= getHeaders, cert =(pemPath,pemKeyPath), verify=False, allow_redirects=True)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Jan 2021 14:51:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/1776745#M1537</guid>
      <dc:creator>beatYesterday</dc:creator>
      <dc:date>2021-01-22T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2082895#M9425</link>
      <description>&lt;P&gt;Can you also give an example in Qlik Sense Desktop?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 19:29:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2082895#M9425</guid>
      <dc:creator>su_</dc:creator>
      <dc:date>2023-06-12T19:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2083772#M9437</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/232657"&gt;@su_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The same example applies to Qlik Sense Desktop. See &lt;A href="https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/GettingStarted/connecting-to-engine-api.htm" target="_blank" rel="noopener"&gt;Connecting to the Qlik Engine JSON API&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;What will change is:&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="mc-variable CommonComponents.SenseEnterpriseName variable"&gt;Qlik Sense Enterprise&lt;/SPAN&gt;:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="Code"&gt;&lt;STRONG&gt;wss&lt;/STRONG&gt;://server.domain.com:4747/app/&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="Code"&gt;wss://server.domain.com[/virtual proxy]/app/&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="mc-variable CommonComponents.SenseDesktopName variable"&gt;Qlik Sense Desktop&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN class="Code"&gt;&lt;STRONG&gt;ws&lt;/STRONG&gt;://localhost:4848/app/&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Code"&gt;All the best,&lt;BR /&gt;Sonja&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 12:52:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2083772#M9437</guid>
      <dc:creator>Sonja_Bauernfeind</dc:creator>
      <dc:date>2023-06-14T12:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2085365#M9483</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28597" target="_blank"&gt;@Sonja_Bauernfeind&lt;/A&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote this code to submit 2 API requests&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Connecting to a Qlik Sense dashboard&lt;/LI&gt;
&lt;LI&gt;Creating a dimension in that dashboard&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I was able to get proper responses from the Qlik server for each API request, but the dimension was never created. I wonder if you would have any clue? See codes and responses below&lt;/P&gt;
&lt;P&gt;Code:&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;import websockets&lt;BR /&gt;import json&lt;BR /&gt;import asyncio&lt;BR /&gt;import time&lt;BR /&gt;&lt;BR /&gt;url = "ws://localhost:4848/app/"&lt;BR /&gt;&lt;BR /&gt;req_open_doc = {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "method": "OpenDoc",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "handle": -1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "params": [&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "C:\\Users\\my_directory\\my_dashboard.qvf"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ],&lt;BR /&gt;&amp;nbsp; "id": 1,&lt;BR /&gt;&amp;nbsp; "outKey": -1,&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;req_create_dim = {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "jsonrpc": "2.0",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "handle": 1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "id": 2,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "method": "CreateDimension",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; "params": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qProp": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qInfo": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qId": "aaaaa",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qType": "dimension"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qDim": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qGrouping": 'N',&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qFieldDefs": [&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "AAC-VERSION PACKAGES"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qFieldLabels": [&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ""&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ],&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qLabelExpression": ""&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; },&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "qMetaDef": {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "title": "HelloFeature",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "description": "",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "tags": [&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "group_HeyFeatureGroup"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;async def call_api():&lt;BR /&gt;&amp;nbsp; &amp;nbsp; async with websockets.connect(url) as ws:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; await ws.send(json.dumps(req_open_doc))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result = await ws.recv()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(result)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result = await ws.recv()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(result)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; await ws.send(json.dumps(req_create_dim))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result = await ws.recv()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; print(result)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # result = await ws.recv()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # print(result)&lt;BR /&gt;&lt;BR /&gt;asyncio.get_event_loop().run_until_complete(call_api())&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;Response:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{"jsonrpc":"2.0","method":"OnConnected","params":{"qSessionState":"SESSION_CREATED"}}&lt;BR /&gt;{"jsonrpc":"2.0","id":1,"result":{"qReturn":{"qType":"Doc","qHandle":1,"qGenericId":"C:\\my_directory\\my_dashboard.qvf"}},"change":[1]} &lt;BR /&gt;{"jsonrpc":"2.0","id":2,"result":{"qReturn":{"qType":"GenericDimension","qHandle":2,"qGener&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 19 Jun 2023 14:27:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2085365#M9483</guid>
      <dc:creator>su_</dc:creator>
      <dc:date>2023-06-19T14:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2086243#M9492</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/232657"&gt;@su_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you require assistance troubleshooting custom code, please post your question directly in the relevant forum:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/integration-extension-apis/bd-p/qlik-sense-integration-extension-api" target="_blank" rel="noopener"&gt;Integration, Extensions &amp;amp; APIs&lt;/A&gt;. If you need&amp;nbsp;&lt;EM&gt;direct&amp;nbsp;&lt;/EM&gt;engagement from Qlik to assist you, I would recommend our Professional Services.&lt;/P&gt;
&lt;P&gt;All the best,&lt;BR /&gt;Sonja&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 10:52:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2086243#M9492</guid>
      <dc:creator>Sonja_Bauernfeind</dc:creator>
      <dc:date>2023-06-21T10:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense: call Qlik Sense Engine API with Python</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2471691#M14303</link>
      <description>&lt;P&gt;Hi All, I am trying to use webscocket Api to connect Qlik Cloud , to pull a table from the cloud and to convert it to the Dataframe panda but I am having issue. It was connecting to the cloud but could not pull the table to my jupyter notebook. here is the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import asyncio
import websockets
import json
import pandas as pd
import nest_asyncio

# Apply the nest_asyncio patch
nest_asyncio.apply()

# Configuration
qlikcloud_url = "wss://mytenant.eu.qlikcloud.com//app/f5555629-bb12-4983-854b-1ed7c9682f55"
api_key = "api key"
app_id = "f5555629-bb12-4983-854b-1ed7c9682f55"
table_object_id = 'ZgGPbV'

async def get_table_data():
    async with websockets.connect(
        qlikcloud_url,
        extra_headers={
            "Authorization": f"Bearer {api_key}"
        }
    ) as websocket:
        # Open the app
        open_doc_request = {
            "jsonrpc": "2.0",
            "id": 1,
            "method": "OpenDoc",
            "handle": -1,
            "params": {
                "qDocName": app_id,
                "qNoData": True
            }
        }
        await websocket.send(json.dumps(open_doc_request))
        response = await websocket.recv()
        open_doc_response = json.loads(response)
        print(f"Open Doc Response: {open_doc_response}")

        # Check if the 'result' key is in the open doc response
        if 'result' in open_doc_response:
            doc_handle = open_doc_response['result']['qReturn']['qHandle']
            print(f"Document Handle: {doc_handle}")

            # Get the object handle
            get_object_request = {
                "jsonrpc": "2.0",
                "id": 2,
                "method": "GetObject",
                "handle": doc_handle,
                "params": {
                    "qId": table_object_id
                }
            }
            await websocket.send(json.dumps(get_object_request))
            response = await websocket.recv()
           get_object_response = json.loads(response)
            print(f"Get Object Response: {get_object_response}")

            if 'result' in get_object_response:
                object_handle = get_object_response['result']['qReturn']['qHandle']
                print(f"Object Handle: {object_handle}")

                # Get the layout of the object
                get_layout_request = {
                    "jsonrpc": "2.0",
                    "id": 3,
                    "method": "GetLayout",
                    "handle": object_handle,
                    "params": {}
                }
                await websocket.send(json.dumps(get_layout_request))
                response = await websocket.recv()
                layout_response = json.loads(response)
                print(f"Table Layout: {layout_response}")

                # Check if the 'result' key is in the layout response
                if 'result' in layout_response and 'qLayout' in layout_response['result']:
                    qLayout = layout_response['result']['qLayout']

                    # Send request to get table data
                    get_data_request = {
                        "jsonrpc": "2.0",
                        "id": 4,                                      "method": "GetHyperCubeData",
                        "handle": object_handle,
                        "params": {
                            "qPath": "/qHyperCubeDef",
                            "qPages": [{"qTop": 0, "qLeft": 0, "qHeight": 1000, "qWidth": 10}]
                        }
                    }
                    await websocket.send(json.dumps(get_data_request))
                    response = await websocket.recv()
                    table_data_response = json.loads(response)
                    print(f"Table Data: {table_data_response}")

                    # Check if 'result' key is in the table data response
                    if 'result' in table_data_response:
                        table_data = table_data_response['result']['qDataPages'][0]
                        print(f"Table Data Pages: {table_data}")

                        rows = table_data['qMatrix']
                        columns = qLayout['qHyperCube']['qDimensionInfo'] + qLayout['qHyperCube']['qMeasureInfo']

                        parsed_data = []
                        for row in rows:
                            parsed_row = {}
                            for col, value in zip(columns, row):                                                                    parsed_row[col['qFallbackTitle']] = value['qText']
                            parsed_data.append(parsed_row)

                        # Convert to DataFrame
                        df = pd.DataFrame(parsed_data)
                        print(df)

                        # Optionally save to CSV
                        df.to_csv("qlikcloud_table_data.csv", index=False)
                    else:
                        print("Error: 'result' key not found in table data response.")
                else:
                    print("Error: 'qLayout' key not found in layout response.")
            else:
                print("Error: 'result' key not found in GetObject response.")
        else:
            print("Error: 'result' key not found in OpenDoc response.")
            print(f"Full OpenDoc Response: {open_doc_response}")

# Run the async function
asyncio.get_event_loop().run_until_complete(get_table_data())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but I keep on getting this error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;pen Doc Response: {'jsonrpc': '2.0', 'method': 'OnConnected', 'params': {'qSessionState': 'SESSION_ATTACHED'}}
Error: 'result' key not found in OpenDoc response.
Full OpenDoc Response: {'jsonrpc': '2.0', 'method': 'OnConnected', 'params': {'qSessionState': 'SESSION_ATTACHED'}}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 10:05:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/tac-p/2471691#M14303</guid>
      <dc:creator>olaoyesunday1</dc:creator>
      <dc:date>2024-07-19T10:05:58Z</dc:date>
    </item>
  </channel>
</rss>

