2 Replies Latest reply: Aug 16, 2017 9:48 AM by kumar parth RSS

    build story in qliksense using engine api

    kumar parth



      I am new to qlik sense.. I am trying to create a story by creating a custom function in mashup for a particular app


      I have followed this link Create a story ‒ Qlik Sense


      to create story ..but I am not able to create a story. What i am doing is trying to do this using websocket by opening a connection and then sending the json containing the create story params but I am receiving invalid request. from the server. I tried the same using the engine explorer and i am able to create the story there, but not able to create story through the code. I have tried everything:See code


      var storyData = {

              "handle": 1,

                "method": "CreateObject",

                "params": {

                "qProp": {

                          "qInfo": {

                          "qId": "story69",

                          "qType": "story"


                "qExtendsId": "",

                "qMetaDef": {

                     "title":"story 69",

                     "description":"a story"





      var socket;

      var host = "wss://xxx.com/app/"+ app.id + "?reloadUri=https://xxx.com/dev-hub/engine-api-explorer";




      var socket = new WebSocket(host);

      console.log('Socket Status: '+ socket.readyState);

      socket.onopen = function(){

      console.log('Socket Status: '+socket.readyState+' (open)');


      console.log('Sent: '+storyData);


      socket.onmessage = function(msg){

      console.log('Received: '+msg.data);




      } catch(exception){




      I am receving from server:


      Socket Status: 0

      bookmarkPoc.js:140 Socket Status: 1 (open)   bookmarkPoc.js:142
      Sent: [object Object]  

      Received: {"jsonrpc":"2.0","method":"OnAuthenticationInformation","params":{"userId":"abc","userDirectory":"xyz","logoutUri":"https://xxx.com/qps/user","mustAuthenticate":false}}

      Received: {"jsonrpc":"2.0","id":0,"error":{"code":-32600,"parameter":"Request processing error","message":"Invalid Request"}}


      Why i am recieving Invalid Request as when i do the same in engine explorer I am able to create a story.


      Please any help is much appreciated.



        • Re: build story in qliksense using engine api
          Todd Margolis

          Hi Kumar,


          I created a Chrome extension a while back to create stories and slides with embedded snapshots. I used qSocks since it makes communicating with the engine much easier. Here is the code I used for creating a new story:

                    var storyProp = {
                         "qInfo": {
                              "qId": "story01",
                              "qType": "story"
                         "qMetaDef": {
                              "title": "Session: " + datestr,
                              "description": "Some description"
                         "rank": 0,
                         "thumbnail": {
                              "qStaticContentUrlDef": {}
                         "qChildListDef": {
                              "qData": {
                                   "title": "/title",
                                   // "description": "/description",
                                   // "children": "/qChildListDef"
                    return new Promise(function(resolve, reject) {
                         handle.createObject(storyProp).then(function(story) {
                              handles.curStory = story;
                              console.log("Story created",story);
                              return resolve(story);
                         }, function(error) {
                              return reject(error);

          I hope this helps.