Product Feedback Forum
Help us make Sisense better by posting your product feedback here.
cancel
Showing results for 
Search instead for 
Did you mean: 

**Please note this idea was migrated to the Product Feedback Forum from older submission areas**

Sisense doesn’t have an API to get data from the Sessions Table. This data is available in the UI only. We would like to be able to use this data in a custom application that we have built.

We’d like to see an API that will allow us to get the Session Table details.

SessionTable - Andriy Symkin.png

 

3 Comments
Status changed to: Needs Votes & Comments
 

as a workaround you can use the same websocket used by the sisense UI or get data from mongodb. If your app is able to run kubectl on the mongodb container, you can get session data as follows:

kubectl -n <sisenseNamespace> exec -it <yourNamespace>-mongodb-0 -c mongodb -- mongo prismWebDB --quiet --eval 'db.getCollection("socket-sessions").find({"registrationDetails.headers.authentication.isAuthenticated": true}, {_id: 0, "registrationDetails.user.userName": 1, "registrationDetails.user.baseRoleName": 1, "registrationDetails.user.tenant.name": 1}).toArray();'

As an alternative, you can enable readuser to access mongodb and access from your app, then run the same query I provided in the previous example. Many other details are available; I just selected the ones I needed, but you can add more or simply get all and handle the useful one in your app

Simple nodejs code:

 

    const uri = `mongodb://sisense-mongodb-headless:27017`;

    const client = new MongoClient(uri);

    try {
        const db = client.db("prismWebDB");
        const collection = db.collection("socket-sessions");
        const sessions = (await collection.find(
                {"registrationDetails.headers.authentication.isAuthenticated": true},
                {_id: 0, "registrationDetails.details": 1}
            ).toArray()).map(s => s.registrationDetails.details);
        logger.debug("Session data (mongodb): " + JSON.stringify(sessions));
        return sessions;
    } catch(e) {
        logger.error("Reading sessions failure", e);
    } finally {
        await client.close();
    }