Forum Discussion

Holguinmora's avatar
Holguinmora
Helper I
6 years ago
Solved

Configure Web Api Connection Several Request

Hi to all!!!   I´m new in Power Bi, days ago I was able to create a connection to a Rest Api using the Web API connection option.   The API deliver 50 lines per reques, the entire data base is ar...
  • Jimmy801's avatar
    6 years ago

    Hello Holguinmora 

    saw that you opened this topic twice...

     

    as you passed me your credentials, I was able to develop something for your. I've tested it and it should work. Here the code

     

    let
        Final = List.Generate
        (
            ()=>
            [
                Result= Json.Document(Web.Contents("https://api.repsly.com/v3/export/clients/0", [Headers=[Accept="application/json"]])),
                TotalCount = 1
        
    
            ],
            each [TotalCount]>0,
            each 
            [
                
                Result= Json.Document(Web.Contents("https://api.repsly.com/v3/export/clients/" & Text.From([Result][MetaCollectionResult][LastTimeStamp]), [Headers=[Accept="application/json"]])) ,
                TotalCount = [Result][MetaCollectionResult][TotalCount]
                 
    
            ],
    
            each [Result][Clients]
        ),
        FinalTable = Table.FromRecords(List.Combine(Final))
    in
        FinalTable

     

     

    Copy paste this code to the advanced editor to see how the solution works

    Give it a test and let us know

    If this post helps or solves your problem, please mark it as solution.
    Kudos are nice to - thanks
    Have fun

    Jimmy