{"id":10185,"library":"qsapi","title":"Qlik Sense qsAPI Client","description":"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.","status":"active","version":"2.2.0","language":"en","source_language":"en","source_url":"https://github.com/rafael-sanz/qsAPI","tags":["qlik","qlik-sense","api-client","business-intelligence"],"install":[{"cmd":"pip install qsapi","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for making HTTP requests to the Qlik Sense APIs.","package":"requests","optional":false},{"reason":"Used for parsing XML responses from some Qlik Sense endpoints.","package":"xmltodict","optional":false}],"imports":[{"note":"The primary class for interacting with Qlik Sense was moved to a sub-module in version 2.1.0. Older versions used the direct import.","wrong":"from qsapi import QlikSenseAPI","symbol":"QlikSenseAPI","correct":"from qsapi.qsapi import QlikSenseAPI"}],"quickstart":{"code":"import os\nfrom qsapi.qsapi import QlikSenseAPI\n\n# Configure Qlik Sense connection details. Use environment variables for production.\nHOST = os.environ.get('QLIK_SENSE_HOST', 'your_qlik_sense_host') # e.g., 'yourserver.example.com'\nCERT_PATH = os.environ.get('QLIK_SENSE_CERT_PATH', '/path/to/client.pem')\nKEY_PATH = os.environ.get('QLIK_SENSE_KEY_PATH', '/path/to/client_key.pem')\nUSER_DIRECTORY = os.environ.get('QLIK_SENSE_USER_DIRECTORY', 'DOMAIN') # e.g., 'YOURDOMAIN'\nUSER_ID = os.environ.get('QLIK_SENSE_USER_ID', 'svc_api_user')\n\ntry:\n    # Initialize the Qlik Sense API client\n    qs_api = QlikSenseAPI(\n        host=HOST,\n        certificate=CERT_PATH,\n        key=KEY_PATH,\n        user_directory=USER_DIRECTORY,\n        user_id=USER_ID\n    )\n\n    # Example: Get Qlik Sense Engine Version\n    engine_version = qs_api.get_engine_version()\n    print(f\"Successfully connected to Qlik Sense. Engine Version: {engine_version}\")\n\n    # Example: Get a list of apps (uncomment to run)\n    # apps = qs_api.get_apps()\n    # print(f\"Found {len(apps)} applications.\")\n    # for app in apps[:2]: # Print details for the first two apps\n    #     print(f\"  - App Name: {app.name}, ID: {app.id}\")\n\nexcept FileNotFoundError as e:\n    print(f\"Error: Certificate or key file not found: {e}. Please ensure paths are correct.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Update your import statements from `from qsapi import QlikSenseAPI` to `from qsapi.qsapi import QlikSenseAPI`.","message":"The package structure and import paths were refactored in version 2.1.0. The main `QlikSenseAPI` class moved from `qsapi` to `qsapi.qsapi`.","severity":"breaking","affected_versions":"< 2.1.0"},{"fix":"Verify that `certificate` and `key` parameters point to existing, readable `.pem` files. Ensure the user specified by `user_directory` and `user_id` in the API call is authorized within Qlik Sense for the actions attempted.","message":"Qlik Sense API authentication via certificates requires correct absolute paths to `client.pem` and `client_key.pem` files, and these files must have appropriate read permissions for the user running the Python script.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Double-check that `user_directory` matches the user directory configured in Qlik Sense (e.g., 'DOMAINS', 'LDAP', 'LOCAL'), and `user_id` is the exact user ID within that directory that the certificate is intended for.","message":"The `user_directory` and `user_id` parameters are crucial for associating the certificate with a Qlik Sense user. Incorrect values can lead to 'Forbidden' (HTTP 403) or 'Unauthorized' errors even with valid certificates.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Change your import statement to `from qsapi.qsapi import QlikSenseAPI`.","cause":"Attempting to import `QlikSenseAPI` directly from the top-level `qsapi` package after version 2.1.0.","error":"ImportError: cannot import name 'QlikSenseAPI' from 'qsapi'"},{"fix":"Verify the absolute paths provided for the `certificate` and `key` parameters in the `QlikSenseAPI` constructor. Ensure the files exist and are accessible.","cause":"The specified path for the Qlik Sense client certificate or key file is incorrect or the file does not exist.","error":"FileNotFoundError: [Errno 2] No such file or directory: '/path/to/client.pem'"},{"fix":"Review the security rules in Qlik Sense for the specified `user_directory` and `user_id`. Ensure the user has read/write access to the resources being queried or modified via the API.","cause":"The authenticated user (defined by `user_directory` and `user_id` in conjunction with the certificate) lacks the necessary permissions within Qlik Sense to perform the requested operation.","error":"requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://your_qlik_sense_host:4242/qrs/about"}]}