Qlik Community

Qlik Sense Documents

Qlik Sense documentation and resources.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW

How to delete a sheet via Qlik repository API using Postman Desktop

rohitk1609
Specialist III
Specialist III

How to delete a sheet via Qlik repository API using Postman Desktop

Hi techies,

The Qlik Sense Repository Service (QRS) contains all data and configuration information for a Qlik Sense site. The data is normally added and updated using the Qlik Management Console (QMC) or a Qlik Sense client, but it is also possible to communicate directly with the QRS using its API. This enables the automation of a range of tasks, for example:

  • Start tasks from an external scheduling tool
  • Change license configurations
  • Extract data about the system

We will learn how to connect with Qlik Sense via repository API using POSTMAN Desktop tool. For practice we will delete a sample sheet by repository API request.

Sheet deletion is one of the operations we can perform via API request. We have different endpoints which we can use in API request to perform operation. 

We can know what are available end points in Qlik API at https://help.qlik.com/en-US/sense-developer/April2020/Subsystems/RepositoryServiceAPI/Content/Sense_...

Prerequisites:

  1. Qlik Sense Enterprise 
  2. Postman Desktop tool
  3. Administrator user for installation of Postman.
  4. Service user account to send API request.

Installation and configuration of Postman:

  1. Download Postman desktop version and install with administrator user.
  2. Download Qlik Sense Enterprise certificates from QMC > Certificate section and export a copy of the certificates used in the site.
    1. Arbitrary machine name (best practice is to use the machine you are making the API calls from)
    2. No password on the files
    3. Include secrets key
    4. PEM Format
  3. Go to Process with PEM Certificates (Simplest, Doesn't Require OpenSSL), Install Qlik certificates by referring https://support.qlik.com/articles/Basic/How-to-configure-Postman-desktop-app-to-connect-to-Qlik-Sens...
  4. Open Postman Desktop=> Go to SSL certificate verification and disable SSL certificate verification

SSL Verifcation Disabled.png

       4. Certificates verification: Add host name, certificates as per below snapshot.:

Certificates.png

              5.  Test connectivity of Postman with QSE. A valid test of postman connectivity with service account would be the following.

  •              Request: https://hostname:4242/qrs/about?xrfkey=1234567890123456
  •             X-Qlik-Xrfkey = 1234567890123456(Xrfkey string is a random string. The only characters that are allowed for use in the Xrfkey parameter are 0 - 9, a - z, and A - Z.)
  •            X-Qlik-User= UserDirectory=Domain;UserId=qliksense(qliksense is service user in this article)Test Connectivity.png

 

If everything is fine then you will see Status 200 OK and build version etc. information of QSE.

How to delete a sheet using repository API

  1. Go to hub and create a sample sheet in any app i.e. DeleteMe
  2. Create a request https://hostname:4242/qrs/app/object?xrfkey=1234567890123456
  3. End point in above request is object.
  4. Go to headers=>set X-Qlik-Xrfkey to any string i.e. 1234567890123456
  5. X-Qlik-User= UserDirectory=internal;UserId=sa_api
  6. Note we are using sa_api user to delete a sheet. Here, service user is ineffective to delete any sheet.

Headers.png

 

Section 2:

  1. Go to Params:
  2. set xrfkey = 1234567890123456
  3. Filter = name eq 'DeleteMe'
  4. This will make request as https://hostname:4242/qrs/app/object?xrfkey=1234567890123456&filter=name eq 'DeleteMe'Params.png
  5. press GET button.
  6. This will bring us sheet details whose name is DeleteMe. 
  7.  GET /qrs/app/object?xrfkey=somerandomstring&filter=app.name eq 'SomeApp' and objectType eq 'sheet' and name eq 'deleteMe'. Is case insensitive
  • Response:

{

        "id": "92366630-3c23-467c-848d-a8733d253289",

        "engineObjectType": "",

        "description": "",

        "objectType": "sheet",

        "publishTime": "1753-01-01T00:00:00.000Z",

        "published": false,

        "name": "DeleteMe",

        "engineObjectId": "77dfef2a-6fa4-4edf-bfce-12d07e14c735",

        "contentHash": "AP=B$+WA3.Z[_H`@E'[;@C!Y9(95?D\/7S92!>TBLKP",

        "privileges": null

    }

       7. Here we need Id detail from response received by GET Request: "id": "92366630-3c23-467c-848d-a8733d253289". 

  • This id 92366630-3c23-467c-848d-a8733d253289 we can find in QMC by going to App objects, filter the records by ID column

Check last columnCheck last column

     8.  Delete a sheet by https://hostname:4242/qrs/app/object/92366630-3c23-467c-848d-a8733d253289?xrfkey=1234567890123456 with keeping X-Qlik-User= UserDirectory=internal;UserId=sa_api

Delete.png

   9. Check QMC or HUB, you will find that DeleteMe sheet is vanished.

Note: This solution uses repository service or API which removes entry of sheet from QSR database not the actually file from binary file present in disk. If you need to cleanse the sheet from disk, please refer this beautiful document created by Levi. 

https://adminplaybook.qlik-poc.com/docs/asset_management/apps/remove_unused_private_sheets.html

You can do many operations as we used delete of sheet. Please check what are the endpoints available in Qlik. End points means what operation you are trying to do with Qlik using API request.

 

 

 

Reach out to me at kumar.rohit1609@gmail.com if there is need of any clarification or assistance 

Connect with me on LinkedIn  https://www.linkedin.com/in/rohit-kumar-67ba152b/

To get latest updates and articles, join Qlik community at  https://www.facebook.com/QlikIntellectuals

When applicable please mark the appropriate replies as ACCEPT AS SOLUTION and LIKE it. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as LIKE if you feel additional info is useful to others.

Version history
Last update:
‎2021-08-14 02:43 AM
Updated by:
Contributors