Blog

Qlikview Management API

  • (4.0)

The QlikView Management API is a web based service through which you can issue a wide range of commands on data reports for  automating the  management activities. These activities can include the following:

>> Creating new  tasks
>> Data Access Permission and its Modification 
>> Licence updating
>> Server setting and its Modifications

Learn how to use QlikView, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll for Free QlikView Training Demo!

The QlikView Management Service (QMS) API available at https://:4799/QMS/Service by default. All communication are nade through HTTP- SOAP protocol.  A "service key" must be supplied as a header of the HTTP request of each operation call, . The HTTP header containing the service key is called X-Service-Key. 
 
For example, the header with a value can look like this:

X-Service-Key: rPnBL6zlbvNr5k2nowI919EJkkOeHsi8

There are different security layers provided to control the access to data and their operations. 
 First layer of security requires a membership of a local group called QlikView Management. 
 
The second layer of security has the local groups QlikView Administrator, QlikView EDX and  the Document Folder Administrator role. 
>> QlikView Administrator provides the highest access level on data
>> QlikView EDX the lowest access level on the document data 
>> The Document Folder Administrator have access to those operations that require QlikView EDX membership, and a QlikView Administrator has access to operations that require Document Folder Administrator membership. 

Step By Step Procedure to build QlikView Management API   

Step 1 – Setting  Permissions to View Data

The user requests to make calls to Management Service by specifying the group of members on the Olik View Server.  This group is initially fromed by QlikView Installer by providing specific user details added to it. The user also required to define the parameters appropriate to the type of application they want the QlikiView BI Tool to run.

Like

Application Parameter
Desktop Login ID
Web page User ID
Specific user to use the tool Embedded code attached to his application
Tab/Mobile Access ID/ Login ID

Step 2 – Create a project & Reference the QlikView Management Web Service 
 
Open Visual Studio to start a new project. Connect the QMS API to visual studio by adding a Service Reference number/ID as shown below.

Add the service reference dialogue enter the following UR address -  https://localhost:4799/QMS/Service - click the Go button and it will connect and validate the QlikView service Server.  Provide a meaningful name for this reference, for example QMSAPIService. It should look as below

Related Page: Qlikview Data Model And Best Practices

Step 3– Configure Visual Studio to use a Service Behaviour
 
A “service key” representing the specific user session within the QlikView server  must be injected into every request he made. QlikView follows a .net project coding  in Visual Studio platform. The steps are as follows:
 
>> In Visual Studio create a new folder called ServiceSupport in the root of the projects folder structure.
>> Download the attached "ServiceSupportFiles.zip" file and extract thiose  files starting with “ServiceKey…cs”.  
>> Now right click  the folder the folder you created above and click “Add | Existing Item” browse to where you saved the files, 
>> select all the files saved  and click Add.  
 
The structure of your project should now look like the below.
 

Next each of these  files needs to have its namespace edited to match the namespace of your entire project.  So open each file and locate the line that will look like this

namespace QMSAPIStarter.ServiceSupport

The namespace of your project will match the name of the project if you didn’t change it and in the above case the text you would change is QMSAPIStarter, leave the ServiceSupport part present
 
Next open web.config or app.config depending on the type of project you have.  Locate the opening tag called and immediately after this  paste the below entry

Notice in the code there are TWO references to the namespace for the code we added above, make sure BOTH of these match the namespace of your project.
Finally locate the following block in the config file


 
Before the closing tag add behaviorConfiguration="ServiceKeyEndpointBehavior"

Save and close the config file.

Frequently Asked QlikView Interview Questions & Answers

Step 4 – Create an object to communicate with the API and add the Service Key
 
The next step is to write the first piece of code to communicate with the web service, handle the service key and from then on the API functions can be used.
Create the item you want to work with, in this example I am creating a simple class and writing code into the Main method, if you are working with a web page you can locate the code, on load or on the click of a button.
 
At the top of your code page add the following statements to reference the support functions and the API itself (correct namespace accordingly):

using QMSAPIStarter.QMSAPIService;
using QMSAPIStarter.ServiceSupport;

Now into the function you are using paste the below code.  This creates the “QMSClient” object from which all subsequent API calls will be made, and packages the service key required to use it.  Here i have hard coded the URL to QMS Web Service if you leave it out it will pick up the URL from your config file.

QMSClient Client;

            string QMS = "https://localhost:4799/QMS/Service";
            Client = new QMSClient("BasicHttpBinding_IQMS", QMS);
            string key = Client.GetTimeLimitedServiceKey();
            ServiceKeyClientMessageInspector.ServiceKey = key;

The ServiceKey is the token that represents your session with the API.  Once the token is obtained it is valid for 20 minutes however this period is extended after each call to the API so you should only need to request a key once.
  
Step 5 – Issue an API command
 
Now it is possible to issue commands against the API.  Below is a simple function that will ask for the list of services on the QlikView server and print out their names.

ServiceInfo[] myServices = Client.GetServices(ServiceTypes.All);

            foreach (ServiceInfo service in myServices)
            {
                Console.WriteLine(service.Name);
             }

Build your project and execute it to see the results. You can now build and run your own applications using the API. 

Explore QlikView Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

 


Popular Courses in 2018

Get Updates on Tech posts, Interview & Certification questions and training schedules