<?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 Iterate Over Web API Pages With Power Query in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Iterate-Over-Web-API-Pages-With-Power-Query/m-p/290632#M8545</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need a little help, please. I have access to API data:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://ip1.i.lithium.com/30e96e794d2f0970536dc80b25424be583fdc905/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f56497345582e6a7067" border="0" alt="" width="339" height="487" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following code to retrieve API data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let iterations = 10,
url = "https://graph.facebook.com/v2.10/[ACCOUNT ID]/insights?access_token=[ACCESS TOKEN]",

FnGetOnePage =
  (url) as record =&amp;gt;
   let
    Source = Json.Document(Web.Contents(url)),
    data = try Source[data] otherwise null,
    next = try Source[paging][next] otherwise null,
    res = [Data=data, Next=next]
   in
    res,

 GeneratedList =
  List.Generate(
   ()=&amp;gt;[i=0, res = FnGetOnePage(url)],
   each [i]&amp;lt;iterations and [res][Data]&amp;lt;&amp;gt;null,
   each [i=[i]+1, res = FnGetOnePage([res][Next])],
   each [res][Data])
 in
  GeneratedList&lt;/PRE&gt;&lt;P&gt;Now I'm trying to retrieve this API data:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://ip1.i.lithium.com/f67bf1ac19badcb28cb4e78388034ab9793cef47/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f30787279322e6a7067" border="0" alt="" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What changes do I need to make to the original code for this? Any help, suggestion or guidance is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Tanim&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2017 08:26:22 GMT</pubDate>
    <dc:creator>Tanim</dc:creator>
    <dc:date>2017-10-26T08:26:22Z</dc:date>
    <item>
      <title>Iterate Over Web API Pages With Power Query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Iterate-Over-Web-API-Pages-With-Power-Query/m-p/290632#M8545</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need a little help, please. I have access to API data:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://ip1.i.lithium.com/30e96e794d2f0970536dc80b25424be583fdc905/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f56497345582e6a7067" border="0" alt="" width="339" height="487" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using the following code to retrieve API data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let iterations = 10,
url = "https://graph.facebook.com/v2.10/[ACCOUNT ID]/insights?access_token=[ACCESS TOKEN]",

FnGetOnePage =
  (url) as record =&amp;gt;
   let
    Source = Json.Document(Web.Contents(url)),
    data = try Source[data] otherwise null,
    next = try Source[paging][next] otherwise null,
    res = [Data=data, Next=next]
   in
    res,

 GeneratedList =
  List.Generate(
   ()=&amp;gt;[i=0, res = FnGetOnePage(url)],
   each [i]&amp;lt;iterations and [res][Data]&amp;lt;&amp;gt;null,
   each [i=[i]+1, res = FnGetOnePage([res][Next])],
   each [res][Data])
 in
  GeneratedList&lt;/PRE&gt;&lt;P&gt;Now I'm trying to retrieve this API data:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://ip1.i.lithium.com/f67bf1ac19badcb28cb4e78388034ab9793cef47/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f30787279322e6a7067" border="0" alt="" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What changes do I need to make to the original code for this? Any help, suggestion or guidance is much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Tanim&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 08:26:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Iterate-Over-Web-API-Pages-With-Power-Query/m-p/290632#M8545</guid>
      <dc:creator>Tanim</dc:creator>
      <dc:date>2017-10-26T08:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Iterate Over Web API Pages With Power Query</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Iterate-Over-Web-API-Pages-With-Power-Query/m-p/290900#M8552</link>
      <description>&lt;P&gt;Fixed it by copy and pasting the last line from the new API data, it basically got rid of the extra "client_pages" bit and working like a charm. Looks like self help is the best help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fixed.png" style="width: 587px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/66672iE471BBF855E8DD73/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fixed.png" alt="Fixed.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 15:38:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Iterate-Over-Web-API-Pages-With-Power-Query/m-p/290900#M8552</guid>
      <dc:creator>Tanim</dc:creator>
      <dc:date>2017-10-26T15:38:50Z</dc:date>
    </item>
  </channel>
</rss>

