Qlik Community

Qlik Sense Enterprise Documents & Videos

Documents & videos about Qlik Sense.

How do I call QlikSense APIs with curl (QMC Task load)

New Contributor

How do I call QlikSense APIs with curl (QMC Task load)

Hello all

As I am a newbie with PowerShell, and always reluctant to add some complementary tools (eg Qlik-Cli), i tried to call APIs by using curl

. As I have been frustrated by the doc in the support website, here is the procedure to make things work . Hope it will help some..

The goal is actually to run a Task Load in the QMC

Install Curl

Can be useful 😉

* Curl Download Wizard


or https://curl.haxx.se/dlwiz/?type=bin&os=Win64&flav=-&ver=-&cpu=x86_64

* doc for installing:  https://code.i-harness.com/fr/q/911219

* Official Curl website https://curl.haxx.se/docs/httpscripting.html

I installed it there :%UserProfile%\AppData\Local\curl-7.59.0-win64-mingw\bin


See  https://help.qlik.com/en-US/sense-developer/September2017/Subsystems/RepositoryServiceAPI/Content/Re...

BUT there is a missing parameter:"  --key path\client_key"

In Dos, in my bin Repository

curl -v ^

--location ^

--cert C:\Users\MyUserName\..\client.pem ^

--key C:\Users\MyUserName\..\client_key.pem ^

--insecure https://MyQlikServerName:4242/qrs/app?xrfkey=0123456789abcdef ^

--header "x-qlik-xrfkey: 0123456789abcdef" ^

--header "X-Qlik-User: UserDirectory=Internal;UserId=sa_repository"

Task Load



Note, for me:  /qrs/task/{id}/start/synchronous => qrs/task/{58b31b78-ad2d-456c-bc01-5356a34c6ee7}/start/synchronous

In Dos, in my bin Repository

curl -v ^

--location ^

--header "Transfer-Encoding: chunked" ^

--cert C:\Users\MyUserName\..\client.pem ^

--key C:\Users\MyUserName\..\client_key.pem ^

--request POST ^

--insecure https:/MyQlikServerName::4242/qrs/task/58b31b78-ad2d-456c-bc01-5356a34c6ee7/start/synchronous?xrfkey=0123456789abcdef ^

--header "x-qlik-xrfkey: 0123456789abcdef" ^

--header "X-Qlik-User: UserDirectory=Internal;UserId=sa_repository"



New Contributor III

In case others, like me, don't want to use certs (root admin) for obvious security reasons when developers call the QRS API with cURL, here is the process through Windows authentication. Windows authentication ensures users calling the QRS API will have same permissions as through QMC.

The key is to first get the session cookie from any GET query, store it and reuse it when sending a POST query, i.e. like to trigger task.

How to start a Qlik task with cURL (Windows authentication)

  • First send GET request to the About endpoint in order to store the session cookie

curl -L --ntlm --negotiate -u : --insecure --header "x-qlik-xrfkey: 0123456789abcdef" --header "User-Agent: Windows" -H "Content-type:application/json" -c QlikCookie.txt https://ServerName/qrs/about?xrfkey=0123456789abcdef

  • Send a POST request to trigger a task, passing the session cookie

curl -L --ntlm --negotiate -u : --insecure --header "x-qlik-xrfkey: 0123456789abcdef" --header "User-Agent: Windows" -H "Content-type:application/json" -b QlikCookie.txt https://ServerName/qrs/task/{Task ID}/start/synchronous?xrfkey=0123456789abcdef -d "foo"

It is enough to match the header and query xrfkey, so make your own for security reasons again.

Version history
Revision #:
1 of 1
Last update:
‎2018-05-22 01:28 PM
Updated by: