Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I cannot find an API for moving a published app to another stream. In QRS API, you can copy an app, publish the copied app and delete the old app. However, this is not acceptable for us because the app_id changes within this process.
I am also open for other API (Engine API, etc.) as long as I can execute them from Javascript.
Any ideas? Thanks a lot!!
Cheers
Moritz
The new values goes in the body of the PUT request. So pseudo-code something like this:
var appInfo = GET('/qrs/app/046b6c7f-0b8a-43b9-b35d-6489e6daee91');
appInfo.stream.id = '5434956a-0008-4e69-bf01-dc38564b6fd7';
PUT('/qrs/app/046b6c7f-0b8a-43b9-b35d-6489e6daee91', appInfo);
Some of this is version dependent but if you're on something modern then either should work. There are technically two endpoints which can use both of which I have examples using the Qlik-Cli-Windows PowerShell library:
https://github.com/levi-turner/QlikSenseScripts/blob/master/qs-cli/qs-cli-move_app-hub_method.ps1
https://github.com/levi-turner/QlikSenseScripts/blob/master/qs-cli/qs-cli-move_app-qmc_method.ps1
I personally prefer the QMC method since it's more extendable since it can leverage certificates for auth.
Cheers
I think it's just a question of changing the "stream.id" property of the app. So do a GET on this:
Change stream.id to the ID of the destination stream, and the do a PUT on this:
Hi Levi_Turner,
that sounds good. However I have to execute it from Javascript, and this qlik-cli is from command line. Maybe there is a way to write command line commands in javascript but that it seems to me to cumbersome.
Thanks!
Hi Yko,
probably this is exactly what I want. But how to change the stream.id of an app exactly. I only see
put /qrs/app/046b6c7f-0b8a-43b9-b35d-6489e6daee91
Is it something like
put /qrs/app/046b6c7f-0b8a-43b9-b35d-6489e6daee91&stream.id=5434956a-0008-4e69-bf01-dc38564b6fd7 ???
I don't find an example. Could you give me an example? Thanks!
Cheers
Moritz
The new values goes in the body of the PUT request. So pseudo-code something like this:
var appInfo = GET('/qrs/app/046b6c7f-0b8a-43b9-b35d-6489e6daee91');
appInfo.stream.id = '5434956a-0008-4e69-bf01-dc38564b6fd7';
PUT('/qrs/app/046b6c7f-0b8a-43b9-b35d-6489e6daee91', appInfo);
That works! Here the javascript code I used:
var httpRequest6 = new XMLHttpRequest();
httpRequest6.open("GET", baseUrl+'/qrs/app/'+AppID_Target+'?xrfkey=abcdefghijklmnop', true);
httpRequest6.setRequestHeader("x-Qlik-Xrfkey", xrfkey);
httpRequest6.send();
httpRequest6.onload= function() {
var qrsResponse = JSON.parse(httpRequest6.response);
qrsResponse.stream.id='83e32f65-b361-48f9-905c-befab5f49993';
var httpRequest7 = new XMLHttpRequest();
httpRequest7.open("PUT", baseUrl+'/qrs/app/'+AppID_Target+'?xrfkey=abcdefghijklmnop', true);
httpRequest7.setRequestHeader("x-Qlik-Xrfkey", xrfkey);
httpRequest7.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
httpRequest7.send( JSON.stringify(qrsResponse) );
httpRequest7.onload= function() {
window.alert(httpRequest7.response);
};