Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
francesco_menin
Partner - Creator III
Partner - Creator III

Qlik Cloud POST Reloads API returns "too many requests"

Hi all,
I have an application on a customer's tenant that triggers the reload of a different app just before the end of script.

We're basically making a REST call to the API endpoint as per standard guide on qlik.dev, and we're getting this error at the same time we're triggering the reload on the app.

Invalid argument. (Connector error: HTTP protocol error 429 (Too Many Requests):

{"traceId":"dc04c017fc1c8087bdb00f9f17432c7a","errors":[{"code":"RELOADS-007","title":"Too many requests.","detail":"A pending reload request already exists for this app"}]})

 It looks like the API call is triggered more than one time with the script (but we don't experience this issue with other apps).

What should we take a look at?

Labels (2)
2 Replies
marksouzacosta

Hi @francesco_menin,

Can you please share your Load Script and the how you setup your REST Connection?

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

francesco_menin
Partner - Creator III
Partner - Creator III
Author

of course, the script in the app itself is very simple, I'm just skipping some variable settings:

...

Load * from "$(pathQvd)*.qvd" (qvd);

Let vConnAPI = 'DataConnections:REST POST Reload';
Let vChildAppId = '<app_id>';

$(Must_Include=lib://$(Environment)_Setup:DataFiles/TriggerReload.qvs);

Call TriggerReload(vChildAppId,vConnAPI,pathReloadLog);

----

meanwhile the QVS script is a bit more complicated:

Sub TriggerReload(vChildAppId,vConnAPI,pathReloadLog)
	
    LIB CONNECT TO '$(vConnAPI)';
    	
    LET vQueryBody = '{""appId"":""$(vChildAppId)"",""partial"":false}';

    // Collect data from the response for logging
    // Configure app ID for reload
    RestConnectorMasterTable:
    SQL SELECT 
        "id",
	"appId",
	"tenantId",
	"userId",
	"type",
	"status",
	"creationTime",
	"__KEY_root"
    FROM JSON (wrap on) "root" PK "__KEY_root"
    WITH CONNECTION (BODY "$(vQueryBody)");
		
    DisConnect;
    		
    ReloadLog:
    NoConcatenate LOAD DISTINCT
        [id] 			AS [Reload ID],
	[appId] 		AS [Reload App ID],
	[tenantId] 		AS [Reload Tenant ID],
	[userId] 		AS [Reload User ID],
	[type] 			AS [Reload Type],
	[status] 		AS [Reload Status],
	[creationTime] 		AS [Reload Creation Time],
	DocumentName()		AS [Reload Trigger App ID],
	DocumentTitle()		AS [Reload Trigger App Name]
    RESIDENT RestConnectorMasterTable
    WHERE NOT IsNull([__KEY_root]);
		
    // Set variables to produce log filenames
    LET vReloadTime	= Timestamp(Peek('Reload Creation Time',0),'YYYYMMDDhhmmss');
    LET vReloadID 	= Peek('Reload ID',0);
		
    // Check to see if the reload request returned rows, and the variables carry data. If not, fail this reload
    If (NoOfRows('ReloadLog') <> 1) OR ('$(vReloadTime)' = '') OR ('$(vReloadID)' = '') THEN
        // Fail with an error for the log
	Call Error('An unexpected number of rows was returned by the reloads API, or invalid data was found.');
    END IF;
    
    TRACE >>> Returned reload $(vReloadID) at $(vReloadTime);
    
    // Store logs and clear model
    STORE ReloadLog INTO [$(pathReloadLog)ReloadLog_$(vChildAppId)_$(vReloadID)_$(vReloadTime).qvd] (qvd);
    DROP TABLE ReloadLog;
    DROP TABLE RestConnectorMasterTable;   
    
End Sub