none
Connecting to API - Looping Over Pagination RRS feed

  • Question

  • I am attempting to retrieve information from a web API that paginates the results.  Monday may return 2 pages but Tuesday may return 100, example URL: 

    https://FakeAPI.com/stores?access_key=X&per_page=100&page=1

    I am able to retrieve the total number of pages variable using the below query:

    let
        Source = Json.Document(Web.Contents("https://FakeAPI.com/stores?access_key=X&per_page=100")),
        #"Converted to Table" = Record.ToTable(Source[pagination_info]),
        #"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "page_count")),
        MaxSheets = #"Filtered Rows"{0}[Value]
    in
        MaxSheets


    Using the above information, how do I append multiple sources by looping through page numbers until hitting MaxSheets?


    Thanks!

    Friday, October 2, 2015 9:50 PM

Answers