cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Help with API refresh on Power BI Service

Hi All, 

 

I've been given a Power BI file with an API connector that calls a JSON file. The problem is when I upload the file to Power BI Service it won't let me refresh. I get this error: 

image.png

How can I update the code to make sure it refreshes on Power BI service? 

 

Thanks in advance!

 

Here's the code for the data source: 

 

code.PNG

 

And the code in a text format: 

 

 

let 
    BaseUrl         = "URL",
    Token           = "TOKEN",
 
    GetJson = (Url) =>
        let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
            RawData = Web.Contents(Url, Options),
            Json    = Json.Document(RawData)
        in  Json,
  
    GetPage = (Index) =>
        let Url   = BaseUrl & "&page=" & Text.From(Index),
            Json  = GetJson(Url),
            Value = Json
        in Value,

    PageCount   = 20,
    PageIndices = { 1 .. PageCount },
    Pages       = List.Transform(PageIndices, each GetPage(_)),
    Entities    = List.Union(Pages),
    #"Converted to Table" = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

 

 

 

1 REPLY 1
lbendlin
Super User III
Super User III

Your base URL may be too detailed. Follow this guidance to make it more generic

 

https://blog.crossjoin.co.uk/2016/08/23/web-contents-m-functions-and-dataset-refresh-errors-in-power...

 

 

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Kudoed Authors