Forum Discussion
Anonymous access
- 10 years ago
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.
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
- gilbertendaya5 years agoHelper IV
Hi DuncanP sahilhira162 hope you're both well.
I would like to ask for assistance on this.
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.