Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
netwire
Frequent Visitor

Connect with secure JSON source

Hi,

I'm a newbie to PowerBI. I know that PowerBI can connect to pre-built web services like Google Analytics, but how do I connect to other online sources that aren't part of PowerBI yet but require authentication? For example, many JSON sources require HTTP Basic Authentication. I looked into oData Feed but I don't think it works with JSON data sources. I also read http://superuser.com/questions/977249/loading-a-json-file-into-power-query/977376#977376 which connects with publicly viewable JSON API's (and then convert them to PowerBI table), but I don't think that works with secure API's. Any ideas on how to address this?

Dean

2 REPLIES 2
dstramilov
Helper II
Helper II

netwire,

 

for your API example below use Get Data - Web - in Power Bi Desktop. http://api.nobelprize.org/v1/laureate.json

 

or use this 

 

let
    Source = Json.Document(Web.Contents("http://api.nobelprize.org/v1/laureate.json")),
    laureates = Source[laureates],
    #"Converted to Table" = Table.FromList(laureates, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "firstname", "surname", "born", "died", "bornCountry", "bornCountryCode", "bornCity", "diedCountry", "diedCountryCode", "diedCity", "gender", "prizes"}, {"id", "firstname", "surname", "born", "died", "bornCountry", "bornCountryCode", "bornCity", "diedCountry", "diedCountryCode", "diedCity", "gender", "prizes"})
in
    #"Expanded Column1"

for basic auth API, use something like this. 

 

let
 authKey = "{""Username"":""USERNAME"",""Password"":""PASSWORDGOESHERE"",""LocationID"":""LOCATIONIFNEEDED""}",
 url = "https://APILINKGOESHERE.com",
 // Uses the authentication/token method to obtain a token
 GetJson = Web.Contents(url,
     [
         Headers = [#"Content-Type"="application/json"],
         Content = Text.ToBinary(authKey),
         RelativePath="/Authentication/AuthorizeUser"
     ]
 )
in
    GetJson

 

I'm trying the basic auth API method and getting the error below.

DataSource.Error: Web.Contents with the Content option is only supported when connecting anonymously.

Any ideas?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.