-
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Stefan Stoichev edited this page Nov 1, 2021
·
3 revisions
- create new tag
- upload an app (qvf)
- update the app
- set custom property value for the new app (the custom property already exists in Qlik)
- add the newly created tag to the app
(to learn more about filtering syntax check here)
import fs from "fs";
import https from "https";
import { QlikRepositoryClient } from "qlik-rest-api";
const repoClient = new QlikRepositoryClient(someConfig);
const newTag = await repoClient.Post(`tag`, {
name: "New Tag",
});
// get data for specific custom property
// by using the "filter" query parameter
const customProp = await repoApi
.Get("customPropertyDefinition?filter=(name eq 'SomeCustomProperty')")
.then((c) => c.data[0]);
const qvf = fs.readFileSync("path/to/some/app.qvf");
// optional. set the name of the uploaded app
// const newAppName = encodeURIComponent("My New App");
// upload the qvf
const newApp = await repoClient.Post(
`app/upload`, // add ?name=${newAppName} to set the new name,
qvf,
"application/vnd.qlik.sense.app"
);
// update the modifiedDate to avoid 409 response (Conflict)
newApp.modifiedDate: new Date().toISOString();
// update the customProperties sections of the app object
newApp.customProperties = [
{
Definition: {
ID: customProp.id,
},
Value: "some-value",
},
];
// add the newly create tag to the app object
newApp.tags = [{
id: newTag.data.id
}]
// if the name was not set during the upload process
// it can be changed here
// newApp.name = "My New App"
// send update response to the Repo API
const updateApp = await await repoClient.Put(`app/${newApp.data.id}`, newApp);
import { QlikSaaSClient } from "qlik-rest-api";
const saasClient = new QlikSaaSClient(someConfig);
// create new app
const newApp = await saasClient.Post("apps", {
attributes: {
name: "My New App",
description: "My new Qlik SaaS app",
},
});
// update app's name
const updateAppName = await saas.Put(`apps/${newApp.data.attributes.id}`, {
attributes: {
name: "My New App (updated name)",
},
});
Documentation for all methods can be found here