Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

pschmidt1973
New Contributor II

How to trigger tasks using the QRS API based on tags

We have a multi-tenanted environment and need to start customer tasks on a daily basis. By way of an example, we have 33 customers that each have their own reload task. The data is extracted from a customer's onsite source on a daily basis and loaded into a multi-tenanted Data Warehouse.

The Qlik Sense tasks run based on a daily schedule at 8 am each morning, this is not ideal as the Qlik Sense tasks do not know when the Data Warehouse has finished loading. Ideally, I would like to trigger each task via the QRS API once the DWH has completed.

Each customer reload task has been a tagged with the source system the data relates to, for example, the 33 customers have a tag of "HPOS" against each reload task.

I would like to be able to use the QRS API to do two things:

1. Filter a list of reload tasks based on a tag, in the above example "HPOS".

2. Start the reload tasks based on the filtered list.

Any suggestions are welcome.

1 Reply
Employee
Employee

Re: How to trigger tasks using the QRS API based on tags

I would suggest that you explore the Qlik CLI (GitHub - ahaydon/Qlik-Cli: Qlik Sense Cmdlet for PowerShell) which allows you to utilize the Qlik Sense Repository Service (QRS) APIs through PowerShell.

Get-QlikTask -full returns a list of all tasks, including the tag values.


Get-QlikTask -full | where {$_.tags.name -eq "HPOS"}) pipes the task list into a filter, to only keep the required tags.


(Get-QlikTask -full | where {$_.tags.name -eq "HPOS"}).id limits the filtered task list to only the task ID values.

(Get-QlikTask -full | where {$_.tags.name -eq "HPOS"}).id | foreach { Start-QlikTask $_ } as a final step pipes each filtered task ID to being started.