Skip to main content

Qlik Sense QRS API: How to avoid Error 429 error while repetitive activity need to be executed trough QRS API

100% helpful (1/1)
cancel
Showing results for 
Search instead for 
Did you mean: 
Caterina_Fruci
Support
Support

Qlik Sense QRS API: How to avoid Error 429 error while repetitive activity need to be executed trough QRS API

Last Update:

Mar 10, 2023 6:49:07 AM

Updated By:

Sonja_Bauernfeind

Created date:

Mar 10, 2023 6:49:07 AM

A DoS (Denial of Service) protection may trigger Error 429 while generating repetitive calls to the QRS API.

See Qlik Sense QRS API: Error 429 in September 2020 and later when uploading a file for details.

 

Resolution

The following PowerShell demonstrates how to use the API /qrs/selection to run an action (such as delete) on multiple items of a Qlik Management Console resource (example: App) while preventing the HTTP 429 error triggered by sending too many requests.

The same approach prevents the engine stall if the DoS (Denial of Service) protection is disabled as shown on the article Qlik Sense QRS API: Error 429 in September 2020 and later when uploading a file.

Here is a PowerShell sample that provides a command line interface for showing how to automatically delete all the Apps of a Stream in a safe way:

 

$ServerName =  "apcqscn01.apc.pri"
$StreamName =  "TestDeleteApp"
$AppsToDelete = Get-QlikApp -filter "stream.id eq $($Stream.id)"
$NAppsToDelete = $AppsToDelete.count
$Count = 1

Write-Host "Deleting $($NAppsToDelete) Apps from Stream $StreamNames "

$Selections = @()
foreach($AppToDelete in $AppsToDelete)
{    
	#$AppToDelete = $App.id   
	$Selections += [pscustomobject] @{
        type  = 'App'        
		objectID = $AppToDelete.id    
	}    
	#Write-Host "Deleted App '$($AppToDelete.name)' - $Count of App $NAppsToDelete "    
	$Count +=1
}

$SelectionsRequest = @{    
	items = $Selections
}

$Body = ConvertTo-Json $SelectionsRequest  -depth 10 -Compress
$Url = $("https://" + $ServerName + "/qrs/Selection")

$SelectionAnswer = Invoke-QlikPost -path /qrs/Selection -body $Body #-Verbose

$Path = $("/qrs/selection/" + $SelectionAnswer.id +"/app")

Measure-Command {    $DeleteRresult = Invoke-QlikDelete -path $Path #-Verbose
}

 

The script has been successfully tested to delete 300 App in a call on a small test environment.

 

Environment

#Qlik Sense Enterprise on Windows  September 2020 and later releases

Tags (1)
Labels (1)
Version history
Last update:
‎2023-03-10 06:49 AM
Updated by: