Qlik Community

Ask a Question

Knowledge

Search or browse our knowledge base to find answers to your questions ranging from account questions to troubleshooting error messages. The content is curated and updated by our global Support team

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources. Prep for the big move: READ DETAILS

QlikView: Call QMS API with cURL

Damien_Villaret
Support
Support

QlikView: Call QMS API with cURL

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)
Attachments
Comments
sdcentre
Contributor
Contributor

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
Contributor

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

 

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