Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

QlikView: Call QMS API with cURL

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_Villaret
Support
Support

QlikView: Call QMS API with cURL

Last Update:

Jul 5, 2021 8:13:20 AM

Updated By:

Sonja_Bauernfeind

Created date:

Aug 31, 2017 3:28:49 AM

Attachments

cURL is a command-line tool for transferring data using various protocols, native to Linux. There are binaries available for Microsoft Windows, however; you can download them from the Web, such as at cURL's website (scroll to the bottom for Windows distributions, select a zip or 7zip download, unzip it to your machine, and open a command line in the bin or src directories):

https://curl.haxx.se/download.html

This article explains how to call QMS API using cURL with some examples.

The IQMS interface is deprecated in QlikView 12 and IQMS2 should be used instead.

An example in QlikView 12 is:

http://ws.qliktech.com/QMS/12/IQMS/GetTimeLimitedServiceKey

At the time of writing this article, the old IQMS interface is still available in 12.0 and 12.10 but is not recommended. 

 

Environment:

QlikView 

 

Resolution:


First of all before performing a call, you need to get a Service Key. This is used for most of API calls towards the QMS API.

The call that you will use to do this will use a file in the same directory as where you run cURL:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetTimeLimitedServiceKey xmlns="http://ws.qliktech.com/QMS/12/">
</GetTimeLimitedServiceKey>
</s:Body>
</s:Envelope>

 


You can then make this call:

curl --ntlm --user USERNAME:PASSWORD -H "Content-type:text/xml;charset=utf-8" -H "SOAPACTION:http://ws.qliktech.com/QMS/12/IQMS/GetTimeLimitedServiceKey" --user-agent "" --DATA @req1.xml http://YOURQLIKSERVER:4799/QMS/Service


Replace USERNAME and PASSWORD by your Windows username and password. The user must be in the "QlikView Administrators" group on the QlikView Server where the Management service is running. Be sure to also use the correct address of your server.

The service key generated with this call is valid for 1 minute

Once this is done, you can use the service key to run a command through the QMS API.

Below an example of how to GetServices:

curl --ntlm --user USERNAME:PASSWORD -H "Content-type:text/xml;charset=utf-8" -H "SOAPACTION:http://ws.qliktech.com/QMS/11/IQMS/GetServices" -H "X-Service-Key:IC8HgiknhMz8Tvy4YVk93yUaNbiohxkO" --user-agent "" --DATA @req2.xml http://QlikViewServer.domain.local:4799/QMS/Service


 


IC8HgiknhMz8Tvy4YVk93yUaNbiohxkO is the value of the Service Key obtained just before.
req2.xml contains the following:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetServices xmlns="http://ws.qliktech.com/QMS/11/">
<serviceTypes>All</serviceTypes>
</GetServices>
</s:Body>
</s:Envelope>


An example:

curl --ntlm --user USERNAME:PASSWORD -H "Content-type:text/xml;charset=utf-8" -H "X-Service-Key:IC8HgiknhMz8Tvy4YVk93yUaNbiohxkO" -H "SOAPACTION:http://ws.qliktech.com/QMS/12/IQMS/AbortTask" --user-agent "" --DATA @req3.xml http://QlikViewServer.domain.local:4799/QMS/Service


IC8HgiknhMz8Tvy4YVk93yUaNbiohxkO is the value of the Service Key obtained just before.
req3.xml is a file containing the following in Qlikview:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <AbortTask xmlns="http://ws.qliktech.com/QMS/12/">
        <taskID>8840332e-5776-4c52-9ae5-e913f75530c7</taskID>
    </AbortTask>
  </s:Body>
</s:Envelope>


8840332e-5776-4c52-9ae5-e913f75530c7 is the task ID for the task you want to abort. You can find this information in the QMC under Status > Tasks, and then clicking "Show Task Details" and selecting the "Log" tab.
 

(2017-09-22 17:12:03) Information: QDSID=8ffc7be9-da42-3b05-153e-c20d6dcc8ccd

(2017-09-22 17:12:03) Information: TaskID=3dcc9684-d927-4350-96ac-9ecb52646722

(2017-09-22 17:12:03) Information: ExecID=2cb9e894-81b5-489e-b166-ee200a91442a


Included is a zip file for QV12 containing a text file of request examples, and several XML body file examples. Make sure to replace USERNAME:PASSWORD, YOURQLIKSERVER, SERVICE_KEY_RESULT, and YOUR_TASK_ID with the appropriate information.

Labels (2)
Comments
sdcentre
Contributor II
Contributor II

Hi,

Sorry for bringing the old topic up, but I am having some issues with the approach described here. In my case curl command does not return anything: neither a key nor an error. I can see a progress output (please see below) and that means that something is happening. However, I have no idea where to find the key. Could you please assist?

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 191 0 0 100 191 0 529 --:--:-- --:--:-- --:--:-- 529

Best regards,
Vlad

Damien_Villaret
Support
Support

Hello @sdcentre 
Do you mean when you run:

curl --ntlm --user USERNAME:PASSWORD -H "Content-type:text/xml;charset=utf-8" -H "SOAPACTION:http://ws.qliktech.com/QMS/12/IQMS/GetTimeLimitedServiceKey" --user-agent "" --DATA @xmlBodyFiles/GetTimeLimitedServiceKey.xml http://YOURQLIKSERVER:4799/QMS/Service > keyResult.txt

You should be able to find the key in the keyResult.txt text file in the same folder.

sdcentre
Contributor II
Contributor II

Hi,

I saved a file called req1.xml in the same folder I run curl comand from. The content of this file looks like this:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetTimeLimitedServiceKey xmlns="http://ws.qliktech.com/QMS/12/">
</GetTimeLimitedServiceKey>
</s:Body>
</s:Envelope>

Then I executed the following command (USERNAME, PASSWORD and YOURQLIKSERVER are replaced by relevant entries):

curl --ntlm --user USERNAME:PASSWORD -H "Content-type:text/xml;charset=utf-8" -H "SOAPACTION:http://ws.qliktech.com/QMS/12/IQMS2/GetTimeLimitedServiceKey" --user-agent "" --DATA @req1.xml http://YOURQLIKSERVER:4799/QMS/Service > keyResult.txt

Nothing happenned. Am I missing something important here?

Best regards,
Vlad

 

 

Damien_Villaret
Support
Support

Hi @sdcentre 

Is the user used part of the local windows group "QlikView Management API " as listed in the prerequisites on the help site ? 

https://help.qlik.com/en-US/qlikview-developer/May2021/Subsystems/QMSAPIref/Content/Home.htm

If the group doesn't exist, it needs to be created and you might need to log out/log in again for that to get applied.

 

Have you also tried with other tools such as PowerShell to isolate if that is a cURL issue or a misconfiguration on the QlikView Server ?
https://community.qlik.com/t5/Knowledge/QlikView-Call-QMS-API-with-PowerShell/ta-p/1713678

 

Contributors
Version history
Last update:
‎2021-07-05 08:13 AM
Updated by: