Created
July 2, 2015 20:26
-
-
Save mindspank/ece082d4a00b477ad635 to your computer and use it in GitHub Desktop.
QRS-Listapps.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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-akl', | |
port: 4242, | |
path: '/qrs/app?xrfkey=abcdefghijklmnop', | |
method: 'GET', | |
headers: { | |
'x-qlik-xrfkey': 'abcdefghijklmnop', | |
'X-Qlik-User': 'UserDirectory= Internal; UserId= sa_repository ', | |
'Content-Type': 'application/json' | |
}, | |
key: fs.readFileSync(__dirname + '/client_key.pem'), | |
cert: fs.readFileSync(__dirname + '/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