Skip to content

Instantly share code, notes, and snippets.

@yianni-ververis
Created July 10, 2015 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yianni-ververis/576c7c3c526e71c7c3dd to your computer and use it in GitHub Desktop.
Save yianni-ververis/576c7c3c526e71c7c3dd to your computer and use it in GitHub Desktop.
/**
* 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: 'usrad-jvs.qliktech.com',
port: 4242,
path: '/qrs/task/start/synchronous?name=pga&xrfkey=abcdefghijklmnop',
method: 'GET',
headers: {
'x-qlik-xrfkey': 'abcdefghijklmnop',
'X-Qlik-User': 'UserDirectory= Internal; UserId= sa_repository ',
'Content-Type': 'application/json'
},
key: fs.readFileSync('C:\\certs\\client_key.pem'),
cert: fs.readFileSync('C:\\certs\\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