NodeJS/browser package to interact with Qlik Sense Repostory API (QSEoW)
Installation
npm install qlik-repo-api
Usage example
- NodeJS example (certificates) that will get list of apps based on Repo API filter and then update all apps by adding tags and custom properties
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 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 update them
const updateResponse = await Promise.all(
filterApp.map((app) =>
app.update({
tags: ["tag-name-1", "tag-name-2"],
customProperties: [
"customProperty1=value1",
"customProperty1=value2",
"customProperty2=some-value",
],
})
)
);
Documentation
Source code and documentation can be found at the package repository and wiki page
Code documentation can be found at this page