<?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: Piwik API - lastX in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745990#M5418</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/47074"&gt;@rbartley&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess is that Qlik is not happy with the format of the data coming back when it has multiple results in the record set.&lt;/P&gt;&lt;P&gt;What I would suggest is that enumerate around for days 0 to 365, concatenating the results.&lt;/P&gt;&lt;P&gt;To do this you will need to not put the&amp;nbsp;&lt;STRONG&gt;date&lt;/STRONG&gt; parameter in the URL and inject it using&amp;nbsp;&lt;STRONG&gt;WITH CONNECTION&lt;/STRONG&gt;. This allows you to alter your API call in your load script.&lt;/P&gt;&lt;P&gt;There is help on this here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm#WITH-CONNECTION-pagination" target="_blank"&gt;https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm#WITH-CONNECTION-pagination&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The code would be something like;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LIB CONNECT TO 'REST Library';

for iDay - 0 to 365
   let sDay = date(today()-iDay, 'YYYY-MM-DD');

    RESTData:
    SQL SELECT
	"Field1",
        "Field2"
    FROM JSON (wrap on) "root" PK "__KEY_root"
    WITH CONNECTION (
      QUERY "date" "$(sDay)"
    );
next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To avoid having too many REST connection libraries set up on my servers I tend to just have a 'Generic GET' and a 'Generic PUT' connector which points to a placeholder endpoint and then overwrite the whole URL, headers and parameters using WITH CONNECTION. This keeps things tidier and makes code easier to read.&lt;/P&gt;&lt;P&gt;This blog post describes this in more detail:&lt;BR /&gt;&lt;A href="https://www.quickintelligence.co.uk/reading-rss-feeds-with-qlik-rest-connector/" target="_blank"&gt;https://www.quickintelligence.co.uk/reading-rss-feeds-with-qlik-rest-connector/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Sep 2020 12:19:23 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2020-09-22T12:19:23Z</dc:date>
    <item>
      <title>Piwik API - lastX</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745717#M5412</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have just begun working on an app to report on PiWik data using a REST connector.&amp;nbsp; I can connect and return data for a&amp;nbsp; single date, but when I try to return data by day for the last year, I receive an error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see &lt;A href="http://php.net/strtotime" target="_blank" rel="noopener"&gt;http://php.net/strtotime&lt;/A&gt; for more information): &amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I copy and paste the URL I am using into my browser, the result returns fine, but when I use the Select Data to load window, I receive the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The url is:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://webanalytics.ec.europa.eu/?module=API&amp;amp;method=VisitsSummary.get&amp;amp;idSite=527&amp;amp;date=previous5&amp;amp;period=day&amp;amp;format=xml&amp;amp;token_auth=" target="_blank" rel="noopener"&gt;https://&amp;lt;servername&amp;gt;/?module=API&amp;amp;method=VisitsSummary.get&amp;amp;idSite=&amp;lt;site number&amp;gt;&amp;amp;date=last365&amp;amp;period=day&amp;amp;format=xml&amp;amp;token_auth=&amp;lt;token hash&amp;gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 07:02:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745717#M5412</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2020-09-22T07:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Piwik API - lastX</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745913#M5416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/47074"&gt;@rbartley&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the PHP documentation I can't see that&amp;nbsp;&lt;STRONG&gt;last365&lt;/STRONG&gt; is supported. You could try&amp;nbsp;&lt;STRONG&gt;last year&lt;/STRONG&gt; instead?&lt;/P&gt;&lt;P&gt;Seems strange it would work in a browser and not in the REST connector though.&lt;/P&gt;&lt;P&gt;Are you pasting the entire URL in the URL window, or are you specifying the parameters separately later on in the connector properties?&lt;/P&gt;&lt;P&gt;If you have spaces in the URL (for&amp;nbsp;&lt;STRONG&gt;last year&lt;/STRONG&gt;) you may need to put %20 in place of the space.&lt;/P&gt;&lt;P&gt;Have you tried other date periods in there? If so, what results did you get there.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 09:20:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745913#M5416</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2020-09-22T09:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Piwik API - lastX</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745969#M5417</link>
      <description>&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;I'm passing the entire URL, including the date and period parameters in the url text box of the REST connection.&amp;nbsp; I have tried last year (and last%20year),but this gives me summary values for the whole of the last year rather than a break down by day&lt;/P&gt;&lt;P&gt;e.g. lastX gives me something like this.......&lt;/P&gt;&lt;P&gt;&amp;lt;results&amp;gt;&lt;BR /&gt;&amp;lt;result&amp;nbsp;date="2020-09-13"&amp;gt;&lt;BR /&gt;&amp;lt;nb_uniq_visitors&amp;gt;48&amp;lt;/nb_uniq_visitors&amp;gt;&lt;BR /&gt;&amp;lt;nb_users&amp;gt;0&amp;lt;/nb_users&amp;gt;&lt;BR /&gt;&amp;lt;nb_visits&amp;gt;61&amp;lt;/nb_visits&amp;gt;&lt;BR /&gt;&amp;lt;nb_actions&amp;gt;273&amp;lt;/nb_actions&amp;gt;&lt;BR /&gt;&amp;lt;nb_visits_converted&amp;gt;0&amp;lt;/nb_visits_converted&amp;gt;&lt;BR /&gt;&amp;lt;bounce_count&amp;gt;22&amp;lt;/bounce_count&amp;gt;&lt;BR /&gt;&amp;lt;sum_visit_length&amp;gt;18227&amp;lt;/sum_visit_length&amp;gt;&lt;BR /&gt;&amp;lt;max_actions&amp;gt;26&amp;lt;/max_actions&amp;gt;&lt;BR /&gt;&amp;lt;bounce_rate&amp;gt;36.07%&amp;lt;/bounce_rate&amp;gt;&lt;BR /&gt;&amp;lt;nb_actions_per_visit&amp;gt;4.48&amp;lt;/nb_actions_per_visit&amp;gt;&lt;BR /&gt;&amp;lt;avg_time_on_site&amp;gt;299&amp;lt;/avg_time_on_site&amp;gt;&lt;BR /&gt;&amp;lt;/result&amp;gt;&lt;BR /&gt;&amp;lt;result&amp;nbsp;date="2020-09-14"&amp;gt;&lt;BR /&gt;&amp;lt;nb_uniq_visitors&amp;gt;217&amp;lt;/nb_uniq_visitors&amp;gt;&lt;BR /&gt;&amp;lt;nb_users&amp;gt;0&amp;lt;/nb_users&amp;gt;&lt;BR /&gt;&amp;lt;nb_visits&amp;gt;249&amp;lt;/nb_visits&amp;gt;&lt;BR /&gt;&amp;lt;nb_actions&amp;gt;760&amp;lt;/nb_actions&amp;gt;&lt;BR /&gt;&amp;lt;nb_visits_converted&amp;gt;0&amp;lt;/nb_visits_converted&amp;gt;&lt;BR /&gt;&amp;lt;bounce_count&amp;gt;133&amp;lt;/bounce_count&amp;gt;&lt;BR /&gt;&amp;lt;sum_visit_length&amp;gt;53160&amp;lt;/sum_visit_length&amp;gt;&lt;BR /&gt;&amp;lt;max_actions&amp;gt;35&amp;lt;/max_actions&amp;gt;&lt;BR /&gt;&amp;lt;bounce_rate&amp;gt;53.41%&amp;lt;/bounce_rate&amp;gt;&lt;BR /&gt;&amp;lt;nb_actions_per_visit&amp;gt;3.05&amp;lt;/nb_actions_per_visit&amp;gt;&lt;BR /&gt;&amp;lt;avg_time_on_site&amp;gt;213&amp;lt;/avg_time_on_site&amp;gt;&lt;BR /&gt;&amp;lt;/result&amp;gt;&lt;BR /&gt;&amp;nbsp;....&lt;/P&gt;&lt;P&gt;while last year gives me&amp;nbsp; a single set&lt;/P&gt;&lt;P&gt;&amp;lt;result&amp;gt;&lt;BR /&gt;&amp;lt;nb_uniq_visitors&amp;gt;18&amp;lt;/nb_uniq_visitors&amp;gt;&lt;BR /&gt;&amp;lt;nb_users&amp;gt;0&amp;lt;/nb_users&amp;gt;&lt;BR /&gt;&amp;lt;nb_visits&amp;gt;18&amp;lt;/nb_visits&amp;gt;&lt;BR /&gt;&amp;lt;nb_actions&amp;gt;63&amp;lt;/nb_actions&amp;gt;&lt;BR /&gt;&amp;lt;nb_visits_converted&amp;gt;0&amp;lt;/nb_visits_converted&amp;gt;&lt;BR /&gt;&amp;lt;bounce_count&amp;gt;7&amp;lt;/bounce_count&amp;gt;&lt;BR /&gt;&amp;lt;sum_visit_length&amp;gt;8157&amp;lt;/sum_visit_length&amp;gt;&lt;BR /&gt;&amp;lt;max_actions&amp;gt;16&amp;lt;/max_actions&amp;gt;&lt;BR /&gt;&amp;lt;bounce_rate&amp;gt;38.89%&amp;lt;/bounce_rate&amp;gt;&lt;BR /&gt;&amp;lt;nb_actions_per_visit&amp;gt;3.5&amp;lt;/nb_actions_per_visit&amp;gt;&lt;BR /&gt;&amp;lt;avg_time_on_site&amp;gt;453&amp;lt;/avg_time_on_site&amp;gt;&lt;BR /&gt;&amp;lt;/result&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 11:33:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745969#M5417</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2020-09-22T11:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Piwik API - lastX</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745990#M5418</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/47074"&gt;@rbartley&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess is that Qlik is not happy with the format of the data coming back when it has multiple results in the record set.&lt;/P&gt;&lt;P&gt;What I would suggest is that enumerate around for days 0 to 365, concatenating the results.&lt;/P&gt;&lt;P&gt;To do this you will need to not put the&amp;nbsp;&lt;STRONG&gt;date&lt;/STRONG&gt; parameter in the URL and inject it using&amp;nbsp;&lt;STRONG&gt;WITH CONNECTION&lt;/STRONG&gt;. This allows you to alter your API call in your load script.&lt;/P&gt;&lt;P&gt;There is help on this here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm#WITH-CONNECTION-pagination" target="_blank"&gt;https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/Load-REST-data/Load-data.htm#WITH-CONNECTION-pagination&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The code would be something like;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LIB CONNECT TO 'REST Library';

for iDay - 0 to 365
   let sDay = date(today()-iDay, 'YYYY-MM-DD');

    RESTData:
    SQL SELECT
	"Field1",
        "Field2"
    FROM JSON (wrap on) "root" PK "__KEY_root"
    WITH CONNECTION (
      QUERY "date" "$(sDay)"
    );
next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To avoid having too many REST connection libraries set up on my servers I tend to just have a 'Generic GET' and a 'Generic PUT' connector which points to a placeholder endpoint and then overwrite the whole URL, headers and parameters using WITH CONNECTION. This keeps things tidier and makes code easier to read.&lt;/P&gt;&lt;P&gt;This blog post describes this in more detail:&lt;BR /&gt;&lt;A href="https://www.quickintelligence.co.uk/reading-rss-feeds-with-qlik-rest-connector/" target="_blank"&gt;https://www.quickintelligence.co.uk/reading-rss-feeds-with-qlik-rest-connector/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 12:19:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1745990#M5418</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2020-09-22T12:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Piwik API - lastX</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1746279#M5419</link>
      <description>&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;Thanks for responding again.&amp;nbsp; In fact, that's the approach I had taken in the meantime (sorry, I was going to update my post to include this information but you got there before).&amp;nbsp; The WITH CONNECTION is a great tip and I already use this in another app using a REST connector to connect to the JIRA issue tracking system (I probably found it on your quickintelligence at the time) .&lt;/P&gt;&lt;P&gt;&amp;nbsp;It's funny that, when I use lastX for the date parameter, directly through the browser, it appears to process the command/interpret the data&amp;nbsp; in two stages (so that the screen seems to flicker before showing the result).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 07:50:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Piwik-API-lastX/m-p/1746279#M5419</guid>
      <dc:creator>rbartley</dc:creator>
      <dc:date>2020-09-23T07:50:47Z</dc:date>
    </item>
  </channel>
</rss>

