I need to paginate through all of the records from Hubspot API and I am getting stuck at offset pagination loop. According to the Hubspot\'s API documentation, there is no
Please try recursive call to do you need to put your call in subroutine than check for has_more and if it is equal to True call subroutine again. Also Url parameter have to be updated every time with new vid-offset value. Here is example (tested it is working):
SUB getOnePage(vOffset)
LIB CONNECT TO [hubspot_api];
RestConnectorMasterTable:
SQL SELECT
(...)
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION (Url "https://api.hubapi.com/contacts/v1/lists/all/contacts/all/?hapikey=YOURKEY=$(vOffset)");
LET vHasMore = Peek('has-more',-1);
LET vVidOffset = Peek('vid-offset',-1);
DROP Table root;
IF vHasMore = 'True' then
CALL getOnePage($(vVidOffset));
EndIf
EndSub
Because of repeated keys in every CALL we need to change settings in REST connector as follow: