Qliksense REST offset pagination using loop

后端 未结 1 1026
再見小時候
再見小時候 2020-12-12 03:02

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

1条回答
  •  囚心锁ツ
    2020-12-12 03:41

    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:

    0 讨论(0)
提交回复
热议问题