Skip to content

Instantly share code, notes, and snippets.

@mindspank
Created July 10, 2015 16:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindspank/ff8b2cebac911a622477 to your computer and use it in GitHub Desktop.
Save mindspank/ff8b2cebac911a622477 to your computer and use it in GitHub Desktop.
Reload Task By Name - QRS API
/**
* Connects to the QRS API (REST based) using certificates.
* See this article for more information about connecting to QRS https://help.qlik.com/sense/2.0/en-us/developer/Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-Connect-API.htm
*
*/
var https = require('https');
var fs = require('fs');
/**
* Since Qlik Sense is using self-signed certificates out of the box rejectUnauthorized: false is needed.
*/
var options = {
rejectUnauthorized: false,
hostname: 'demos.qlik.com',
port: 4242,
path: '/qrs/task/start/synchronous?name=TEST&xrfkey=abcdefghijklmnop',
method: 'POST',
headers: {
'x-qlik-xrfkey': 'abcdefghijklmnop',
'X-Qlik-User': 'UserDirectory= Internal; UserId= sa_repository ',
'Content-Type': 'application/json'
},
key: fs.readFileSync(__dirname + '/certs/demos.qlik.com/client_key.pem'),
cert: fs.readFileSync(__dirname + '/certs/demos.qlik.com/client.pem')
};
https.get(options, function(res) {
console.log("Got response: " + res.statusCode)
res.on("data", function(chunk) {
console.log("BODY: " + chunk);
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment