<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Qlik Cloud POST Reloads API returns &amp;quot;too many requests&amp;quot; in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484456#M21339</link>
    <description>&lt;P&gt;of course, the script in the app itself is very simple, I'm just skipping some variable settings:&lt;BR /&gt;&lt;BR /&gt;...&lt;/P&gt;
&lt;P&gt;Load * from "$(pathQvd)*.qvd" (qvd);&lt;/P&gt;
&lt;P&gt;Let vConnAPI = 'DataConnections:REST POST Reload';&lt;BR /&gt;Let vChildAppId = '&amp;lt;app_id&amp;gt;';&lt;/P&gt;
&lt;P&gt;$(Must_Include=lib://$(Environment)_Setup:DataFiles/TriggerReload.qvs);&lt;/P&gt;
&lt;P&gt;Call TriggerReload(vChildAppId,vConnAPI,pathReloadLog);&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;meanwhile the QVS script is a bit more complicated:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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') &amp;lt;&amp;gt; 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 &amp;gt;&amp;gt;&amp;gt; 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&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2024 19:46:46 GMT</pubDate>
    <dc:creator>francesco_menin</dc:creator>
    <dc:date>2024-09-30T19:46:46Z</dc:date>
    <item>
      <title>Qlik Cloud POST Reloads API returns "too many requests"</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484449#M21336</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;I have an application on a customer's tenant that triggers the reload of a different app just before the end of script.&lt;/P&gt;
&lt;P&gt;We're basically making a REST call to the API endpoint as per standard guide on qlik.dev, and&amp;nbsp;we're getting this error at the same time we're triggering the reload on the app.&lt;/P&gt;
&lt;PRE class="reload-log--log"&gt;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"}]})&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;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).&lt;/P&gt;
&lt;P&gt;What should we take a look at?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 19:14:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484449#M21336</guid>
      <dc:creator>francesco_menin</dc:creator>
      <dc:date>2024-09-30T19:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Cloud POST Reloads API returns "too many requests"</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484451#M21337</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/42759"&gt;@francesco_menin&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Can you please share your Load Script and the how you setup your REST Connection?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Mark Costa&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 19:31:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484451#M21337</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-09-30T19:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Cloud POST Reloads API returns "too many requests"</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484456#M21339</link>
      <description>&lt;P&gt;of course, the script in the app itself is very simple, I'm just skipping some variable settings:&lt;BR /&gt;&lt;BR /&gt;...&lt;/P&gt;
&lt;P&gt;Load * from "$(pathQvd)*.qvd" (qvd);&lt;/P&gt;
&lt;P&gt;Let vConnAPI = 'DataConnections:REST POST Reload';&lt;BR /&gt;Let vChildAppId = '&amp;lt;app_id&amp;gt;';&lt;/P&gt;
&lt;P&gt;$(Must_Include=lib://$(Environment)_Setup:DataFiles/TriggerReload.qvs);&lt;/P&gt;
&lt;P&gt;Call TriggerReload(vChildAppId,vConnAPI,pathReloadLog);&lt;/P&gt;
&lt;P&gt;----&lt;/P&gt;
&lt;P&gt;meanwhile the QVS script is a bit more complicated:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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') &amp;lt;&amp;gt; 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 &amp;gt;&amp;gt;&amp;gt; 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&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 19:46:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Cloud-POST-Reloads-API-returns-quot-too-many-requests-quot/m-p/2484456#M21339</guid>
      <dc:creator>francesco_menin</dc:creator>
      <dc:date>2024-09-30T19:46:46Z</dc:date>
    </item>
  </channel>
</rss>

