10 Replies Latest reply: Jan 25, 2017 9:42 AM by Rajesh Vaswani RSS

    Create Stream API - Qlik Sense

    Lucas Blancher

      Hey Everyone,

           Does anyone know if their is an API in Qlik Sense for creating Streams? I see that I can create an app and publish it to an existing stream but their does not seam to be a CreateStream/MakeStream API call. 

       

      I've been using https://help.qlik.com/sense/en-us/developer/#../Subsystems/EngineAPI/Content/WorkingWithAppsAndVisualizations/PublishApp… for a reference.

       

      Regards,

      Lucas

        • Re: Create Stream API - Qlik Sense
          Jeffrey Goldberg

          Lucas,

           

          You can use the QRS API to create a stream.  Here is a link to a windows app that contains samples for working with QRS API: Qlik Sense Repository API Windows App.  Below is an example using Postman to demonstrate the minimal set of properties in the json object.

           

          Remember the call to QRS API to create a stream is a POST

           

          Here is a screenshot:

          QSPT.png

            • Re: Create Stream API - Qlik Sense
              Lucas Blancher

              Thank you Jeffery!  This worked.  One more question, do you know where i can find out more about the Stream API?  I would also like to be able to add/modify the security of the stream if possible.

               

              Regards,

              Lucas

                • Re: Create Stream API - Qlik Sense
                  Jeffrey Goldberg

                  Lucas,

                   

                  You want to review the Qlik Repository API.  The QRS API allows you to set up streams and define the security rules for the streams as well.

                   

                  Here is the link to the reference documentation: http://help.qlik.com/sense/en-us/developer/#../Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositorySe…

                  • Re: Create Stream API - Qlik Sense

                    Hi Lucas, I've been trying to do something similar to you, create apps, streams and publish apps all via QRS. I've been able to accomplish eveything except assigning a user to a stream through QRS - did you ever manage to achieve this?

                     

                    Would you be willing to share your insights? Thanks

                     

                    Ian

                      • Re: Create Stream API - Qlik Sense
                        Alexander Karlsson

                        Hey Ian,

                         

                        Hmm that's not how access control is done in QS.
                        You can check this entry out in the Help around designing access control, https://help.qlik.com/sense/2.0/en-US/online/Subsystems/ManagementConsole/Content/design-access-control.htm

                         

                        Well, in theory you could create one rule per user and per stream but that is highly discouraged as you quickly run into an enormous mess of rules to manage.

                         

                        This is an example request to create a new rule that apply to a specific stream, this is also a good method to see what gets sent to the QRS API. Just emulate the same action in QMC since it uses the same API

                         

                        streampost.PNG

                          • Re: Create Stream API - Qlik Sense

                            Hi Alexander,

                             

                            thanks for the reply and for your advice, it's very much appreciated.

                             

                            As you mention linking single users to single streams isn't generally advisable, but in our particular implementation we are having multiple customers accessing one or two apps, we are having individual customers accessing individual apps.

                             

                            So the design of the solution is driven by need, and your help was great to identify what we were missing (the user to stream mapping)

                             

                            What was really important and helpful was the tip to use the browser to see what's being posted by QMC and then replicate through QRS. In this case we had the struture correct, but there was a slight syntax error.

                             

                            What we passed through

                            {"name":"Security rule for access to stream name","category":"Security","rule":"((user.name="UserName"))","type":"Custom","privileges":["read"],"resourceFilter":"Stream_streamid","actions":2}

                             

                            What QMC was doing

                            {"name":"Security rule for access to stream name","category":"Security","rule":"((user.name=\"UserName\"))","type":"Custom","privileges":["create","read","update"],"resourceFilter":"Stream_streamid","actions":2,}

                             

                            So two things were different here.

                            We only wanted users to have READ permissions, but even when you set this in QMC, it still sets ["create","read","update"], but it does set the actions value to 2, which appears to be different depending on the permissions you set.

                             

                            Anyway, we managed to get where we wanted to and your help was a contributing factor, so thanks again.

                             

                            I hope this is helpful?

                             

                            I.

                              • Re: Create Stream API - Qlik Sense
                                Alexander Karlsson

                                Hmm, and you have nothing that distinguishes the different customers from each other?
                                We have done similar setups before but then we either sent in user properties or customer specific user directories to assign app priviliges.

                                 

                                For example, Stream A is accessible for User Directory A. Within stream A users with properties superuser can access app B, everyone can access app C etc.

                                 

                                If you do ticketing it's fairly easy to assign more specific properties to the users as they access the system.

                        • Re: Create Stream API - Qlik Sense
                          Rajesh Vaswani

                          Hi Jeff,

                           

                          How is the certificate specified for Postman?

                           

                          For creating a new stream this is the only JSON i am passing i.e. {"name","foo"}

                          Would this be sufficient for the QRS API or we will need to pass more parameters. Please let me know.

                           

                          thanks,

                          Rajesh Vaswani

                        • Re: Create Stream API - Qlik Sense

                          All of our customers have different ID's, and each has 3 apps that are created just for them (all duplicates from a template).

                           

                          Right now, we've set up streams for each of them to enable the apps to be grouped together, and then used the user to stream association for ease. In the future, we're going to have users that will have access to multiple streams.

                           

                          All users come from the same directory, so I can't segregate based on directory.

                           

                          All of the app/stream/user management is triggered by a user sign-up process, where users will use our service for anything from a month to a rolling subscription.

                           

                          The multi stream to user relationship is likely to be managed more manually as this will be less frequent.

                           

                          At the end of the subscription, we will have code that automatically un-publishes the apps, deletes the streams etc.

                           

                          I'm sure as we really learn to use Qlik, we'll find better, more efficient ways to do things. We've only been using it for 3 weeks, and we're still learning, but learning quickly

                           

                          Thanks for your input though, it's good to stop and think about the approach.

                          Ian.