Qlik Sense qsAPI Client

2.2.0 · active · verified Fri Apr 17

qsAPI is a Python client library designed for interacting with Qlik Sense's QPS (Qlik Proxy Service) and QRS (Qlik Repository Service) interfaces. It simplifies common administrative and data operations within a Qlik Sense environment, providing a programmatic way to manage apps, users, security rules, and more. The current version is 2.2.0, and the library receives updates periodically, with major refactorings in its 2.1.0 release.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `QlikSenseAPI` client using certificate-based authentication and fetch the Qlik Sense engine version. It highlights common configuration parameters for connecting to a Qlik Sense Enterprise server.

import os
from qsapi.qsapi import QlikSenseAPI

# Configure Qlik Sense connection details. Use environment variables for production.
HOST = os.environ.get('QLIK_SENSE_HOST', 'your_qlik_sense_host') # e.g., 'yourserver.example.com'
CERT_PATH = os.environ.get('QLIK_SENSE_CERT_PATH', '/path/to/client.pem')
KEY_PATH = os.environ.get('QLIK_SENSE_KEY_PATH', '/path/to/client_key.pem')
USER_DIRECTORY = os.environ.get('QLIK_SENSE_USER_DIRECTORY', 'DOMAIN') # e.g., 'YOURDOMAIN'
USER_ID = os.environ.get('QLIK_SENSE_USER_ID', 'svc_api_user')

try:
    # Initialize the Qlik Sense API client
    qs_api = QlikSenseAPI(
        host=HOST,
        certificate=CERT_PATH,
        key=KEY_PATH,
        user_directory=USER_DIRECTORY,
        user_id=USER_ID
    )

    # Example: Get Qlik Sense Engine Version
    engine_version = qs_api.get_engine_version()
    print(f"Successfully connected to Qlik Sense. Engine Version: {engine_version}")

    # Example: Get a list of apps (uncomment to run)
    # apps = qs_api.get_apps()
    # print(f"Found {len(apps)} applications.")
    # for app in apps[:2]: # Print details for the first two apps
    #     print(f"  - App Name: {app.name}, ID: {app.id}")

except FileNotFoundError as e:
    print(f"Error: Certificate or key file not found: {e}. Please ensure paths are correct.")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →