Created
July 10, 2015 16:23
-
-
Save mindspank/ff8b2cebac911a622477 to your computer and use it in GitHub Desktop.
Reload Task By Name - QRS API
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: '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