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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
aldodfm
Frequent Visitor

Anonymous access

Hello @Community,

 

I have a power query with a REST api call:

 

 authKey = "Bearer blablablaKey",
 url = "https://blablablaendpoint.com/api/v1/usage/2016",

 GetJsonQuery = Web.Contents(url,
     [
         Headers = [#"Authorization"=authKey, #"Content-Type"="application/json"]
     ]
 ),
FormatAsJsonQuery = Json.Document(GetJsonQuery),

So, this power query use "Anonymous" authentication. When i refresh this query in Power BI Desktop appears credentials error, but if you accept the power query is executed and everything is ok.

But when i try to schedule refresh in Power BI service appears the credentials problems but doesn't exists a way to say "execute anyway".

 

Is like Power BI service checks the anonymous access to the URL and if it doesn't work, power bi doesn't try to execute the power query script.

 

power_bi_erro_01.pngpower_bi_erro_02.pngpower_bi_erro_03.png

 

Please, there is something to do? Power BI team will do something?

 

Thx in advance.

1 ACCEPTED SOLUTION

I had the same issue and logged a support ticket with Microsoft because I wanted to build my own Google Analytics queries (include filters, segments, etc).

Here's the answer I got from the support team:
This is not possible due to constraints with the way Web.Contents stores credentials. They are stored based upon the URL value passed, and there can only be one URL per Dataset. In this case, you're trying to short-circuit a typical oAuth2 flow (one URL) and call the API (another URL). I made an attempt at using RelativePath to 'trick' the service, but stills require that the root of those two endpoints returned a valid HTTP 200 response to indicate connection success. In this case, https://www.googleapis.com returns a 404. Unfortunately, therefore it is not possible as an uploaded PBIX file. I suggest creating a new issue describing what data you would want to see in the Google Analytics content pack (https://app.powerbi.com/groups/me/getdata/services/google-analytics) and we can see about adding it to the model.

The only workaround for me so far, is to execute the query elsewhere (for me it's Google Spreadsheet) and connect PBI to that as a data source.

 

View solution in original post

33 REPLIES 33

Thanks @sahilhira162

 

I am a newbie to the powerBI and I am using powerBI desktop. can you please tell me how to set the powerBI datasource to anonymous.  or please give a path to it

 

 

Thanks

yakkalipavan

Hi @DuncanP

 

My current JSON call is : 
Source = Web.Contents("complete url (not just root url)", [Headers=[#"Authorization"="API Key"]]),
convertToJson = Json.Document(Source),
data = convertToJson[data]

 

Data at my URL path is already in JSON format.
Can you elaborate what changes should I make and add to my relative path parameter.??
Sorry if this is too basic, I am new to Power BI.

Regards,
Sahil

Hi @sahilhira162

 

All you should need to do, is modify the first line to:

Source = Web.Contents("Root URL", [Headers=[#"Authorization"="API Key"], RelativePath="/Rest of URL"]),

I ran into a similar version of this issue the other day, where I could get Power BI Desktop to pull the data in, but couldn't get auto-refresh to work online. It's a common enough problem with the way that Power Query does its authentication, meaning that sometimes you need to use the base URL and add the relative path. Chris Webb has more on the relative path usage in his blog.

 

Duncan

Hi @DuncanP  @sahilhira162 hope you're both well. 

I would like to ask for assistance on this.

 

image1.JPG

 

 

 

 

 

 

 

 

I was able to get the token and tried to pass to other API with Authorization header.

 

But I'm having this error---> "We couldn't authenticate with the credentials provided.Please try again"

Please advise.

DuncanP,

 

I am trying to solve the same issue, but still getting error, do you mind to write a bit more how you solved this problem please.

 

Dmitry

Hi Dmitry

 

Can you post your code and the issue you're having?

 

Duncan

I was able to fix it using your method.

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

So thank DuncanP you for your idea!

 

Hi,

I need to login to website to see my orders with username and password. Can you tell me how ot do it? 
example:  i have www.shopify.com. i am admin of the company profile. I need to get the order and sale details. 
I have username and password but it says that authentication failed but i am able to login with the same user name password in the web site,

Hi,

I need to login to website to see my orders with username and password. Can you tell me how ot do it? 
example:  i have www.shopify.com. i am admin of the company profile. I need to get the order and sale details. 
I have username and password but it says that authentication failed but i am able to login with the same user name password in the web site,

Glad I could help!

 

Duncan

Another helpful hint is to set 2+ seconds delay between API queries in between. In may case delay solved refresh issue.

Indeed, but in my case the root url returns a 401. So i did the workaround that @fso said.

aldodfm
Frequent Visitor

Any help from Microsoft? How i can contact with them?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors