<?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: Download LOG file using QRS API in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1567020#M10312</link>
    <description>&lt;DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;GET &lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;qrs&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;ReloadTask&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ReloadTaskID}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Response:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;You need the &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;"operational"&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;"fileReferenceID"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;GET &lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;qrs&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;ReloadTask&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ReloadTaskID}&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;scriptlog?fileReferenceId&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;{fileReferenceID}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Example Response:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;"value"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"99ceba11-8ca5-4b0b-ba3d-e08fc8643863"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;GET &lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;qrs&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;download&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;reloadtask&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ID &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; previous call}&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ArbitraryFileName.FileExt}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Tue, 09 Apr 2019 14:44:33 GMT</pubDate>
    <dc:creator>Levi_Turner</dc:creator>
    <dc:date>2019-04-09T14:44:33Z</dc:date>
    <item>
      <title>Download LOG file using QRS API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1567000#M10310</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to figure out a way to be able to download the log file using the REST API.&lt;/P&gt;&lt;P&gt;I able to locate the file using the API endpoint &lt;EM&gt;FileReference.&amp;nbsp;&lt;/EM&gt;However, i am not able to figure out a way to be able to download the file as&amp;nbsp; a result of the API call.&lt;/P&gt;&lt;P&gt;here is what i am using&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;REST call:&amp;nbsp;&lt;/STRONG&gt; &amp;lt;servername&amp;gt;/qrs/filereference/&amp;lt;filereference_id&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Response:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;id                 : fd8ad364-109b-4924-adfa-7ae285bbf00d
createdDate        : 2019-03-05T10:38:35.354Z
modifiedDate       : 2019-03-05T10:38:35.354Z
modifiedByUserName : INTERNAL\sa_scheduler
location           : myserver\Script\40ab5878-2164-4275-bbe0-0824fa04e040.2019_03_05_10_19_11.B5B796AD93CF2FFCEC06.log
size               : 309341
hash               : flG4jmMasEaHO7OJiV9Nxbw==
syncDirection      : 1
fileType           : 1
privileges         : 
schemaPath         : FileReference&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, i have the log file name and the path under the location key.&lt;/P&gt;&lt;P&gt;Can someone help me figure out how to download the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aadil&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:07:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1567000#M10310</guid>
      <dc:creator>aadil_madarveet</dc:creator>
      <dc:date>2024-11-16T06:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Download LOG file using QRS API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1567020#M10312</link>
      <description>&lt;DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;GET &lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;qrs&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;ReloadTask&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ReloadTaskID}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Response:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;You need the &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;"operational"&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;"fileReferenceID"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;GET &lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;qrs&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;ReloadTask&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ReloadTaskID}&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;scriptlog?fileReferenceId&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;{fileReferenceID}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Example Response:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;"value"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;"99ceba11-8ca5-4b0b-ba3d-e08fc8643863"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;GET &lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;qrs&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;download&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;reloadtask&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ID &lt;/SPAN&gt;&lt;SPAN&gt;from&lt;/SPAN&gt;&lt;SPAN&gt; previous call}&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;{ArbitraryFileName.FileExt}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Apr 2019 14:44:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1567020#M10312</guid>
      <dc:creator>Levi_Turner</dc:creator>
      <dc:date>2019-04-09T14:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Download LOG file using QRS API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1647477#M11815</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;If interested, this is some Qlik Sense script code to download the log file and save it locally.&amp;nbsp;&lt;BR /&gt;It is assuming you have a working REST data connection to QRS API named 'QRS API'&lt;/P&gt;&lt;P&gt;and it uses both&amp;nbsp;&lt;/P&gt;&lt;P&gt;https://localhost/qrs/ReloadTask/$(sTaskId)/scriptlog&amp;nbsp;&lt;BR /&gt;https://localhost/qrs/download/reloadtask/$(vFileReferenceID)/&amp;lt;tmp file&amp;gt;&lt;/P&gt;&lt;P&gt;repository API&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are using it to retrieve regularly the logs of failed jobs before they get overwritten by latest reload task and to fill a Qlik application to track job execution&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// -------------- GetLog --------------------
// Download a task log file via QRS API  
// - Save it locally as log file named sLogName

sub TaskLogs.GetLog(sLogName,sTaskId,sReferenceId)

  TRACE *** Retrieving log ""$(sLogName)"" from taskID $(sTaskId)], referenceId $(sReferenceId);

  // Parameters for QRS API calls
  set vlQRSAPIXrfkey='adcdef0123456789';
  set ErrorMode=0;
  
  TRACE *** Starting qrs/ReloadTask import;

  // Get the "operational"."fileReferenceID" 
  // see https://community.qlik.com/t5/Qlik-Sense-Integration/Download-LOG-file-using-QRS-API/m-p/1567020#M10312 
  LIB CONNECT TO 'QRS API';
  RestConnectorMasterTable:
  SQL SELECT 
      "value"
  FROM JSON (wrap on) "root" 
      WITH CONNECTION ( 
          URL "https://localhost/qrs/ReloadTask/$(sTaskId)/scriptlog", 
          QUERY "fileReferenceId" "$(sReferenceId)",
          QUERY "Xrfkey" "$(vlQRSAPIXrfkey)",
          HTTPHEADER "X-Qlik-Xrfkey" "$(vlQRSAPIXrfkey)",
          HTTPHEADER "User-Agent" "Windows"
      );

  // Verify the validity of the RestConnectorMasterTable
  if IsNull(TableNumber('RestConnectorMasterTable')) or NoOfRows('RestConnectorMasterTable')=0 then
      TRACE *** ERROR: Failure when calling QRS API with  ReloadTask/$(sTaskId)/scriptlog...; 
  else   
    [root]:
    LOAD	[value]
    RESIDENT RestConnectorMasterTable;
    DROP TABLE RestConnectorMasterTable;

    let vFileReferenceID=Peek('value',0,'root');
    TRACE *** TaskLogs.Add retrieved vFileReferenceID $(vFileReferenceID);
    DROP TABLE root;
  end if;  
    
  // Get the file and save it 
  // As this is not true CSV, we need to use a improbable delimiter like 'µ'
  // This is working unless you are trying to get a log which contains this 
  // particular character 
  // if you have a better idea please let me know...
  RestConnectorMasterTable:
  SQL SELECT 
    "col_1"
  FROM CSV (header off, delimiter "µ", quote """" ) "TaskLogs"
  WITH CONNECTION ( 
            URL "https://localhost/qrs/download/reloadtask/$(vFileReferenceID)/tmp.log", 
            QUERY "Xrfkey" "$(vlQRSAPIXrfkey)",
            HTTPHEADER "X-Qlik-Xrfkey" "$(vlQRSAPIXrfkey)",
            HTTPHEADER "User-Agent" "Windows"
        );

  // Verify the validity of the RestConnectorMasterTable
  if IsNull(TableNumber('RestConnectorMasterTable')) or NoOfRows('RestConnectorMasterTable')=0 then
      TRACE *** ERROR: Failure when calling QRS API with download/reloadtask/$(vFileReferenceID)/tmp.log...; 
  else   
    [Log]:
    LOAD	"col_1" as "line"
    RESIDENT RestConnectorMasterTable;
    DROP TABLE RestConnectorMasterTable;

    if ( NoOfRows('Log') &amp;gt; 1 ) then
      STORE "Log" INTO [$(sLogName)] (txt);
    end if;  

    DROP TABLE [Log];
  end if;  

  set vFileReferenceID=;
  set vlQRSAPIXrfkey=;
  set ErrorMode=1;

end sub;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Nov 2019 13:32:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1647477#M11815</guid>
      <dc:creator>thomasmaure</dc:creator>
      <dc:date>2019-11-15T13:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Download LOG file using QRS API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1673740#M12298</link>
      <description>&lt;P&gt;Thanks. This is cool.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 07:38:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1673740#M12298</guid>
      <dc:creator>aadil_madarveet</dc:creator>
      <dc:date>2020-02-10T07:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Download LOG file using QRS API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1950887#M17015</link>
      <description>&lt;P&gt;Thanks a lot. I did all you said, but getting a 404 response. Can you please help in this regard?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="subramani_r_0-1656693657851.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/83165iB54C2C6C0699FA19/image-size/medium?v=v2&amp;amp;px=400" role="button" title="subramani_r_0-1656693657851.png" alt="subramani_r_0-1656693657851.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 16:41:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Download-LOG-file-using-QRS-API/m-p/1950887#M17015</guid>
      <dc:creator>subramani_r</dc:creator>
      <dc:date>2022-07-01T16:41:07Z</dc:date>
    </item>
  </channel>
</rss>

