Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
lindybrits
Contributor III
Contributor III

Retrieve User's Selections from an API Call

Hello all

I have been struggling with this for a while - how do I retrieve the current selections of a user in a Qlik Sense application from an API call?

I would like to do this via using the QRS, QPS or Engine API (or combination hereof). The API call will come from a separate Node.js application.

Any help would be appreciated.

Kind Regards,

Lindy Brits.

1 Reply
chrislemm
Partner - Contributor III
Partner - Contributor III

Hi,

you can access the qlik sense json api via websockets. There's an pretty good example how to get the connection running to Qlik Sense Desktop and Enterprise (including certificates).

To get a users selection you need to access the app and pass the handle to an CreateSessionObject type "CurrentSelection".

{

    "method": "CreateSessionObject",

    "handle": 1,

    "params": [

        {

            "qInfo": {

                "qType": "CurrentSelection"

            },

            "qSelectionObjectDef": {}

        }

    ],

    "outKey": -1,

    "id": 2

}

If you call "GetLayout" after, you will receive all fields in qliks json structure.

Check your dev-hub -> engine api explorer for details.

The only problem you might get (I got the problem mentioned here) is that qlik sense will give your websocket a new session besides your browser session, f.e. if you select some values in your browser session and "ask" via nodejs what selections had been made you will receive an empty result.