2 Replies Latest reply: Mar 22, 2017 1:35 PM by Justin Morley RSS

    Accessing Engine API in Qlik Sense Desktop from Node.js

    Justin Morley

      Hi,

      I have a Node.js solution which I've developed which uses the Engine API, wrapped by the marvellous Enigma.js, connecting to a QAP server instance to build and delete new apps on the fly according to given criteria.

      It's all working beautifully in this environment.

       

      Today I tried to port this to my laptop so I could 1) Develop on the move and 2) Show off the rather exciting possibilities such a solution offers. However I hit snags around authentication. My laptop has Desktop on it, not any of the Server versions.

      Is it actually possible to do this - Node.js talking to Qlik Sense Desktop - or is this restricted? The configuration I pass to Enigma is included below. What needs to be different to connect to Qlik Sense Desktop?

       

      {

        schema: qixSchema,

        session: {

            unsecure: false,

            host: qConfig.hostName,

            port: qConfig.QlikServicePort

          },

          createSocket: (url) => {

            return new WebSocket(url, {

              origin: qConfig.hostPrefix + qConfig.hostName,

              cert: fs.readFileSync(qConfig.certDir + qConfig.certPem),

              key: fs.readFileSync(qConfig.certDir + qConfig.keyPem),

              headers: {

                'X-Qlik-User': qConfig.header + qConfig.QlikServiceDirectory + qConfig.middle + qConfig.QlikServiceUser

              },

              rejectUnauthorized: false

            });

        }

        • Re: Accessing Engine API in Qlik Sense Desktop from Node.js
          Nick Webster

          Hi Justin,

           

          Connecting to Qlik Sense Desktop should be fairly straight forward, you just need to change your config to something like this:

          config: {
            unsecure: true, 
            host: "localhost",
            port: 4848
          }
          

           

          You also don't need the certs in your connection as Desktop doesn't require any authentication and, lastly, your node server needs to be running on localhost as Sense Desktop won't accept connections from anywhere else. Given your description above I imagine that that's the case anyway.

           

          In theory that should be it.

           

          I hope that helps.