Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
simonaubert
Partner - Specialist II
Partner - Specialist II

Reloading task from script : authentication with saml and multi-node

Hello all,

The use case : I need to launch Tasks from the script.
What works :
1.on my dev environment, I created a certificate through https://<myserver>/saml/qmc/certificates
2. I set a certificate password and just put a localhost on the certificate name.
3. I copy pasted it from C:\ProgramData\Qlik\Sense\Repository\Exported Certificates
4. I created a connection like that :

simonaubert_0-1600091580409.png

simonaubert_1-1600091797877.png

simonaubert_2-1600091913144.png

simonaubert_4-1600092032296.png

5. I use this  script

 

 

Let vServer = 'localhost';
Let vTaskName = 'Reload task of Extension.Usage.Dashboard';

Let vURL = '"https://$(vServer):4242/qrs/task/start?name=$(vTaskName) "';

LIB CONNECT TO 'REST_local_Task_Launcher';
RestTable:
SQL SELECT
FROM JSON (wrap on) "root"
WITH CONNECTION ( URL $(vURL) );
Drop Table RestTable;

exit script;

 

 

So, okay, I somehow cheated a little but that works ! 🙂

And now I have some difficulties doing the same thing on the production environnement. First of all, it's a multi-node.

So what do I have to do with certificate? What machine name? Which certificate do I have to copy on which machine?

Best regards,

Simon

EDIT : detailed procedure on page 2

Bi Consultant (Dataviz & Dataprep) @ Business & Decision
Labels (1)
14 Replies
simonaubert
Partner - Specialist II
Partner - Specialist II
Author

Hello All,
Here is my detailed procedure

1.Connexion setup (the hard part).

In script, create a new connection of type REST

image.png


configure it as follow :

URL : https://localhost:4242/qrs/task/start?name=TEST_TASK_SAU
Timeout : 900
Method : Post

image.png

HTTP Protocol : 1.1
Request/response body encoding : UTF-8
check :
Add ‘Expect :100-continue’ header,
Auto detect response type,
Check response type during ‘Test connection’

Key generation strategy put to No keys

image.png
Authentication Schema : Anonymous
check Skip server certificate validation
use certificate : From File
PFX file name : client.pfx

Write password of the pfx file

image.png
Query parameters
Name : xrfkey Value : 0000000000000000
Check « Add missing query parameters to final request »

Query headers:
Name : X-Qlik-XrfKey Value : 0000000000000000
Name : X-Qlik-User Value : UserDirectory=internal; UserId=sa_repository

Name : REST_TASK_LAUNCHER

image.png

image.png


If the client.pfx file is missing, here what to do :
Go to QMC, on Certificates. Put localhost as machine name and write a password for the certificate. Click on Export Certificate.

image.png

 

Certificate is exported to central node in repository C:\ProgramData\Qlik\Sense\Repository\Exported Certificates

image.png

Copy paste it on C:\ProgramData\Qlik\Sense\Engine\Certificates on every node.

image.png


Use connexion in script :


//déclenchement de la tâche

Let vServer = 'localhost';

Let vTaskName = '$(v_task_reellement_lancee)';

Let vURL = '"https://$(vServer):4242/qrs/task/start?name=$(vTaskName)"';

trace $(vURL);

LIB CONNECT TO 'REST_TASK_LAUNCHER';

RestTable:

SQL SELECT

FROM JSON (wrap on) "root"

WITH CONNECTION ( URL $(vURL) );

Drop Table RestTable;​


Please note there is also an idea to make it native on Qlik Sense here https://community.qlik.com/t5/Ideas/Launch-natively-a-task-from-script/idi-p/1776117

 

Best regards,

Simon

 

Edit : images are now available

Bi Consultant (Dataviz & Dataprep) @ Business & Decision
mjperreault
Creator
Creator

Thanks for your responses everyone, as my issue seems to be related to a bug with REST CONNECTOR  and POST requests using certificates, I found a different approach authenticating via PROXY which is working!  I got the idea from @ChristofSchwarz video here https://www.youtube.com/watch?v=jiJDDV9B_QU.  I used his process to create a POST connection and this worked.

Here are my connection details

2021-02-19 12_36_29-Test(2) - My new sheet (4) _ Sheets - Qlik Sense.png

 

Then you can create a script like.

2021-02-19 12_38_14-Test(2) - My new sheet (4) _ Sheets - Qlik Sense.png

 

You also need to set up a header virtual proxy but there are thorough details on how to do that in Christof's video

Unfortunately my ultimate goal was to try to create a reload script that would duplicate an app and then replace an existing published app with the duplicate but this is not possible due to "X-HTTP-Method-Override" not working with the REST Connector, bummer!

domanski
Partner - Contributor II
Partner - Contributor II

I had the same problem. I could not etablish a POST command via a certificate from QV to QS. And then i was able to use a POST-command with the virutal proxy of the video from @ChristofSchwarz 🙂
Thank you for all the input in this thread

JHuis
Creator III
Creator III

EDIT:

It works! thank you for this awesome solution!

 

@simonaubert ,

i am following every part of your instruction, but when i try to select data from the datasource, i cant find anything.

Hopefully you can help me?

fabdulazeez
Partner - Creator III
Partner - Creator III

Can a PUT method invoked from the script. I can see only GET and POST method while creating connection