Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 :
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
Hello All,
Here is my detailed procedure
1.Connexion setup (the hard part).
In script, create a new connection of type REST
configure it as follow :
URL : https://localhost:4242/qrs/task/start?name=TEST_TASK_SAU
Timeout : 900
Method : Post
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
Authentication Schema : Anonymous
check Skip server certificate validation
use certificate : From File
PFX file name : client.pfx
Write password of the pfx file
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
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.
Certificate is exported to central node in repository C:\ProgramData\Qlik\Sense\Repository\Exported Certificates
Copy paste it on C:\ProgramData\Qlik\Sense\Engine\Certificates on every node.
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
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
Then you can create a script like.
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!
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
EDIT:
It works! thank you for this awesome solution!
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?
Can a PUT method invoked from the script. I can see only GET and POST method while creating connection