<?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 Qlik Sense - Rest API (Json) + Pagination + Incremental load (new and update) in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-Rest-API-Json-Pagination-Incremental-load-new-and/m-p/2112647#M19111</link>
    <description>&lt;P&gt;Hey, I'm thinking how to apply incrementation (insert and update) when downloading data to a QVD file via REST API (JSON file) and pagination to pages with 100 records (required) at the same time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data retrieved is all the data since the last change.&lt;/P&gt;
&lt;P&gt;I have done the data download with pagination at the moment. And now I wonder where to put the incrementation&lt;/P&gt;
&lt;P&gt;Has anyone done something like this before?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// 1 ------------------------------------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;LIB CONNECT TO 'Get token';&lt;BR /&gt;&lt;BR /&gt;RestConnectorMasterTable:&lt;BR /&gt;SQL SELECT&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt; "accessToken",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "refreshToken"&lt;/SPAN&gt;&lt;BR /&gt;FROM JSON (wrap on) "root";&lt;BR /&gt;&lt;BR /&gt;[root]:&lt;BR /&gt;LOAD [accessToken],&lt;BR /&gt;&lt;SPAN&gt;     [refreshToken]&lt;/SPAN&gt;&lt;BR /&gt;RESIDENT RestConnectorMasterTable;&lt;BR /&gt;DROP TABLE RestConnectorMasterTable;&lt;BR /&gt;&lt;BR /&gt;LET vAccessTokenValue = Peek('accessToken');&lt;BR /&gt;&lt;BR /&gt;// 2 ------------------------------------------------------------------------------------&lt;BR /&gt;
LIB CONNECT TO 'With Access Token';

RestConnectorMasterTable:
SQL SELECT 
	"totalPages",
	"__KEY_root"
FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION (
URL "https://{URLAddress}/search?modifiedOn=2023-09-01T00:00:00.000Z&amp;amp;size=100",
HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)"
);

[root]:
LOAD	[totalPages]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY_root]);
DROP TABLE RestConnectorMasterTable;

let vTotalFetched = FieldValue('totalPages', 1);&lt;BR /&gt;&lt;BR /&gt;// 3 ------------------------------------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;let vStartAt = 0; &lt;BR /&gt;set vPageSize = 100;&lt;BR /&gt;
Do While vStartAt &amp;lt;= vTotalFetched
let vUrl = 'https://{URLAddress}/search?modifiedOn=2023-09-01T00:00:00.000Z&amp;amp;size=' &amp;amp; $(vPageSize) &amp;amp; '&amp;amp;page=' &amp;amp; $(vStartAt) &amp;amp; 'sort=id';

RestConnectorMasterTable:
SQL SELECT
(...)
WITH CONNECTION (
URL "$(vUrl)",
HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)"
);

Store RestConnectorMasterTable into [lib://StageFile/RestConnectorMasterTable.qvd](qvd);
&lt;BR /&gt;(...)&lt;BR /&gt;
[orderContact]:
LOAD	[email],
	[customerNo],
	[firstName],
	[lastName],
	[__FK_orderContact] AS [__KEY_content]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_orderContact]);
&lt;BR /&gt;(...)&lt;BR /&gt;
DROP TABLE RestConnectorMasterTable;

Let vStartAt=vStartAt+1;

Loop
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Sep 2023 20:13:59 GMT</pubDate>
    <dc:creator>BSo</dc:creator>
    <dc:date>2023-09-03T20:13:59Z</dc:date>
    <item>
      <title>Qlik Sense - Rest API (Json) + Pagination + Incremental load (new and update)</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-Rest-API-Json-Pagination-Incremental-load-new-and/m-p/2112647#M19111</link>
      <description>&lt;P&gt;Hey, I'm thinking how to apply incrementation (insert and update) when downloading data to a QVD file via REST API (JSON file) and pagination to pages with 100 records (required) at the same time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data retrieved is all the data since the last change.&lt;/P&gt;
&lt;P&gt;I have done the data download with pagination at the moment. And now I wonder where to put the incrementation&lt;/P&gt;
&lt;P&gt;Has anyone done something like this before?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// 1 ------------------------------------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;LIB CONNECT TO 'Get token';&lt;BR /&gt;&lt;BR /&gt;RestConnectorMasterTable:&lt;BR /&gt;SQL SELECT&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt; "accessToken",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "refreshToken"&lt;/SPAN&gt;&lt;BR /&gt;FROM JSON (wrap on) "root";&lt;BR /&gt;&lt;BR /&gt;[root]:&lt;BR /&gt;LOAD [accessToken],&lt;BR /&gt;&lt;SPAN&gt;     [refreshToken]&lt;/SPAN&gt;&lt;BR /&gt;RESIDENT RestConnectorMasterTable;&lt;BR /&gt;DROP TABLE RestConnectorMasterTable;&lt;BR /&gt;&lt;BR /&gt;LET vAccessTokenValue = Peek('accessToken');&lt;BR /&gt;&lt;BR /&gt;// 2 ------------------------------------------------------------------------------------&lt;BR /&gt;
LIB CONNECT TO 'With Access Token';

RestConnectorMasterTable:
SQL SELECT 
	"totalPages",
	"__KEY_root"
FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION (
URL "https://{URLAddress}/search?modifiedOn=2023-09-01T00:00:00.000Z&amp;amp;size=100",
HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)"
);

[root]:
LOAD	[totalPages]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY_root]);
DROP TABLE RestConnectorMasterTable;

let vTotalFetched = FieldValue('totalPages', 1);&lt;BR /&gt;&lt;BR /&gt;// 3 ------------------------------------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;let vStartAt = 0; &lt;BR /&gt;set vPageSize = 100;&lt;BR /&gt;
Do While vStartAt &amp;lt;= vTotalFetched
let vUrl = 'https://{URLAddress}/search?modifiedOn=2023-09-01T00:00:00.000Z&amp;amp;size=' &amp;amp; $(vPageSize) &amp;amp; '&amp;amp;page=' &amp;amp; $(vStartAt) &amp;amp; 'sort=id';

RestConnectorMasterTable:
SQL SELECT
(...)
WITH CONNECTION (
URL "$(vUrl)",
HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)"
);

Store RestConnectorMasterTable into [lib://StageFile/RestConnectorMasterTable.qvd](qvd);
&lt;BR /&gt;(...)&lt;BR /&gt;
[orderContact]:
LOAD	[email],
	[customerNo],
	[firstName],
	[lastName],
	[__FK_orderContact] AS [__KEY_content]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_orderContact]);
&lt;BR /&gt;(...)&lt;BR /&gt;
DROP TABLE RestConnectorMasterTable;

Let vStartAt=vStartAt+1;

Loop
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Sep 2023 20:13:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-Rest-API-Json-Pagination-Incremental-load-new-and/m-p/2112647#M19111</guid>
      <dc:creator>BSo</dc:creator>
      <dc:date>2023-09-03T20:13:59Z</dc:date>
    </item>
  </channel>
</rss>

