-
-
Notifications
You must be signed in to change notification settings - Fork 0
Authentication
Stefan Stoichev edited this page Dec 16, 2022
·
2 revisions
In the background qlik-repo-api
is using another Informatiqal
package (qlik-rest-api) to communicate with Qlik Sense. For this reason the authentication have to be provided in the same manner.
For details explanation please have a look at qlik-rest-api authentication methods
Below is an example of how to use certificates as authentication method and perform some operations:
import fs from "fs";
import https from "https";
import { QlikRepoApi } from "qlik-repo-api";
const cert = fs.readFileSync(`path/to/client.pem`);
const key = fs.readFileSync(`path/to/client_key.pem`);
const httpsAgentCert = new https.Agent({
rejectUnauthorized: false,
cert: cert,
key: key,
});
const repoApi = new QlikRepoApi.client({
host: "sense-instance.com",
port: 4242, //default 4242
httpsAgent: httpsAgentCert,
authentication: {
user_dir: "SOME_USER_DIR",
user_name: "SOME_USER_ID",
},
});
// get about info
// GET /qrs/about
const about = await repoApi.about.get();
// get single app
// GET qrs/app/some-app-id
const singleApp = await repoApi.apps.get({ id: "some-app-id" });
// remove the selected app
// DELETE qrs/app/some-app-id
await singleApp.remove();
// get list of apps with their name is starting with "License"
// GET qrs/app?filter=name sw 'License'
const filterApp = await repoApi.apps.getFilter({
filter: `name sw 'License'`,
});
// loop through the apps list and delete them
await Promise.all(filterApp.map((app) => app.remove()));
Documentation for all methods can be found here