6 Replies Latest reply: Aug 28, 2017 4:31 AM by Cristian Hainic RSS

    Qlik Engine API - how to make requests? [Python / Twisted]

    Cristian Hainic

      Hi everyone,

       

      I've managed perfectly fine to interact with Qlik Engine via the Engine API Explorer. However, I cannot figure out how to make Engine API calls programmatically. I am using Python with the Twisted library for interacting with websocket servers.

       

      Say I want to do a simple request, e.g. CreateApp. Upon establishing a connection via a Twisted protocol, I am trying to send the following request by that protocol's transport.write() method:

       

      TEST_LOAD = {

        "handle": -1,
        "method": "CreateApp",
        "params": {

        "qAppName": "Test-App",
        "qLocalizedScriptMainSection": ""
        },
        "jsonrpc": "2.0",
        "id": 5
      }

       

      class QlikClient(Protocol):

       

        def connectionMade(self):

        self.transport.write(bytes(json.dumps(TEST_LOAD), encoding='utf-8'))

        print('Sent ', json.dumps(TEST_LOAD), 'to the server.')

       

        def dataReceived(self, data):

        print("Server said:", data)

        self.transport.loseConnection()

       

      The problem is that the Qlik server does not respond. So I am not sure if this is the correct way of sending Qlik Engine requests. The Twisted protocol is built and the connection seems to be established, however I have no reply from the server.

       

      Could anyone please suggest how I could make a proper request to the Qlik Engine API?

       

      Please note that I am using client certificates copies stored locally for authentication.

       

      Thank you,

       

      Chris