QRS API Client
QRS API Client for Qlik Sense Enterprise.
- class qrs_api_client.client.QRSClient(server_name: str, server_port: int, auth_method: str, auth_manager: AuthManager = None, verify_ssl=True)[source]
Bases:
objectClient for interacting with the Qlik Repository Service (QRS) API.
Provides methods for establishing a session and performing CRUD operations on QRS entities.
- app_change_owner(app_id: UUID, user_directory: str, user_id: str) dict[source]
Changes the owner of certain app.
- Parameters:
app_id (UUID) – The ID of the app.
user_directory (str) – The user directory of the new owner.
user_id (str) – The user id of the new owner.
- Returns:
JSON response as a dict.
- Return type:
list
- app_export(app_id: UUID, file_path: str, file_name: str = None, skip_data: bool = False)[source]
Exports an app in a two-step process using POST and GET methods.
- Step 1: POST to /qrs/app/{id}/export/{token} to trigger the export.
The API returns JSON with a ‘downloadPath’ field.
Step 2: GET the downloadPath to download the binary .qvf file.
- Parameters:
app_id (UUID) – The ID of the app to be exported.
file_path (str) – The directory path where the exported app should be stored.
file_name (str, optional) – File name for the exported app (e.g., “MyApp.qvf”). Falls kein Wert übergeben
wurde
genommen. (wird der ursprüngliche Name der Datei)
skip_data
- Returns:
Success message with file name and path, or None if an error occurs.
- Return type:
str
- app_get_custom_properties(app_id: UUID) list[source]
Exports the custom properties of certain app as JSON.
- Parameters:
app_id (UUID) – The ID of the app.
- Returns:
JSON response as a list.
- Return type:
list
- app_get_owner(app_id: UUID) dict[source]
Exports the owner of certain app as JSON.
- Parameters:
app_id (UUID) – The ID of the app.
- Returns:
JSON response as a dict.
- Return type:
list
- app_get_tags(app_id: UUID, tags: list)[source]
Exports the tags of certain app as JSON.
- Parameters:
app_id (UUID) – The ID of the app.
tags (list) – List with tags to be imported.
- Returns:
JSON response as a list.
- Return type:
list
- app_set_custom_properties(app_id: UUID, custom_properties: dict)[source]
Inserts custom properties into an app.
- Parameters:
app_id (UUID) – The ID of the app.
custom_properties (dict) – Custom property with name and values to be inserted. The values have a ‘list’ as data type.
- Returns:
JSON response as a list.
- Return type:
list
- app_set_tags(app_id: UUID, tags: list)[source]
Inserts tags into an app.
- Parameters:
app_id (UUID) – The ID of the app.
tags (list) – The tags of the app.
- Returns:
JSON response as a list.
- Return type:
list
- app_upload(app_name: str, file_name: str, keep_data: bool = True, exclude_connections: bool = False)[source]
Executes a POST request to the QRS API.
- Parameters:
app_name (str) – The name of the app after upload.
file_name (str) – The path to the file.
exclude_connections (bool, optional) – If set to true and the uploaded .qvf file contains any data connections, they will not be imported to the system. The default value is false.
keep_data (bool, optional) – If set to false and the uploaded .qvf file contains app data, the data will be silently discarded. The default value is true.
- Returns:
JSON response as a dictionary.
- Return type:
dict
- app_upload_replace(target_app_id: UUID, file_name: str, keep_data: bool = True)[source]
Executes a POST request to the QRS API.
- Parameters:
target_app_id (UUID) – The ID of the app to be replaced.
file_name (str) – The path to the file.
keep_data (bool, optional) – If set to false and the uploaded .qvf file contains app data, the data will be silently discarded. The default value is true.
- Returns:
JSON response as a dictionary.
- Return type:
dict
- create_tag(name: str)[source]
Creates a single tag via the Qlik Repository Service.
Retrieves all existing tags first and checks case-insensitively whether a tag with the given name already exists. If not, a new tag is created via the POST /qrs/tag endpoint.
- Parameters:
name (str) – The name of the tag to create. Comparison with existing tags is case-insensitive.
- Returns:
- JSON response from the API containing the created tag, or
None if a tag with the given name already exists.
- Return type:
dict
- create_tags(names: list[str])[source]
Creates multiple tags in a single API call.
Uses the bulk endpoint POST /qrs/tag/many to create several tags at once. Before sending the request, both already existing tags and duplicates within the input list are filtered out (case-insensitive). If no tags remain after filtering, no request is sent.
- Parameters:
names (list[str]) – List of tag names to create. Already existing names and duplicates within the list are skipped and logged as errors.
- Returns:
- JSON response from the API containing the created tags,
or None if no new tags remain to be created after filtering.
- Return type:
list[dict]
- delete(endpoint: str, params: dict = None) dict[source]
Executes a DELETE request to the QRS API.
- Parameters:
endpoint (str) – The API endpoint to call.
params (dict, optional) – Query parameters as key-value pairs.
- Returns:
JSON response as a dictionary or None if an error occurs.
- Return type:
dict
- get(endpoint: str, params: dict = None, headers: dict = None) dict[source]
Executes a GET request to the QRS API.
- Parameters:
endpoint (str) – The API endpoint to call.
params (dict, optional) – Query parameters as key-value pairs.
headers (dict, optional) – Additional header parameters.
- Returns:
JSON response as a dictionary or None if an error occurs.
- Return type:
dict
- post(endpoint: str, params: dict = None, headers: dict = None, data=None) dict[source]
Executes a POST request to the QRS API.
- Parameters:
endpoint (str) – The API endpoint to call.
params (dict, optional) – Query parameters as key-value pairs.
headers (dict, optional) – Additional header parameters.
data (dict or str, optional) – The JSON payload to include in the request body.
- Returns:
JSON response as a dictionary or None if an error occurs.
- Return type:
dict
- put(endpoint: str, params: dict = None, headers: dict = None, data=None)[source]
Executes a PUT request to the QRS API.
- Parameters:
endpoint (str) – The API endpoint to call.
params (dict, optional) – Query parameters as key-value pairs.
headers (dict, optional)
data
payload
- Returns:
JSON response as a dictionary or None if an error occurs.
- Return type:
dict
- reloadtask_create(app_id, task_name, custom_properties=None, tags: list = None, created_date: datetime = None, modified_date: datetime = None, modified_by_user_name: str = None, schema_events: list = None, composite_events: list = None, schema_path: str = None, privileges: list = None, task_type: int = None, enabled: bool = None, task_session_timeout: int = None, max_retries: int = None, is_manually_triggered: bool = None, operational=None, is_partial_reload: bool = None, time_to_live: int = None, preload_nodes=None) dict[source]
Creates a reload task for a specified app.
- Parameters:
app_id (str) – The ID of the app for which the task is created.
task_name (str) – The name of the reload task to create.
custom_properties (dict, optional) – Dictionary of custom property IDs and their values.
tags (list, optional) – List of tag IDs to associate with the task.
schema_events (list, optional) – List of schema events to schedule the task.
composite_events (list, optional) – List of composite events to schedule the task.
schema_path (str, optional) – Schema path.
privileges (list, optional) – Privileges.
task_type (int, optional) – Task type. Default value is 0.
enabled (bool, optional) – True, if the task is active. Default value is True.
- Returns:
JSON response from the API or None if an error occurs.
- Return type:
dict