Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am connecting with Google Translate API without any problem in PowerQuery, I use my access-token and I get the json response flawlessly.
But then, when i close the Query Editor and the data starts to refresh I am getting an error when trying to authenticate with www.translation.googleapis.com anonymously.
I have also set "Ignore Privacy Levels" in case that was related to the issue but nothing changes.
Is there any way to resolve this?
This is the function I'm using. It gets the data without any issue on the Query Editor, but the anonymous connection fails when refreshing the data on the PowerBI app. I've hidden the token a project name:
let
Source = (ToBeTranslated as text, TargetLang as text) => let
// Define the URL for the API endpoint
url = "https://translation.googleapis.com/language/translate/v2",
// Define the request headers
headers = [
#"Authorization" = "Bearer TokenHere",
#"x-goog-user-project" = "ProjectNameHere",
#"Content-Type" = "application/json; charset=utf-8"
],
// Define the request body
body = Json.FromValue([
q = { ToBeTranslated },
target = TargetLang
]),
// Make the POST request
response = Web.Contents(url, [
Headers = headers,
Content = body
]),
// Parse the JSON response
jsonResponse = Json.Document(response),
// Parse the JSON response
data = jsonResponse[data],
// Parse the JSON response
translations = data[translations],
// Parse the JSON response
translations1 = translations{0},
#"Converted to Table" = Record.ToTable(translations1),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "translatedText")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Name"})
in
#"Removed Columns"
in
Source
Hi @hgarciaf,
Have you tried to use the optional parameter relative path to processing your url? AFAIK, some of api with anonymous authorization only allow to receive the credentials on the root level:
let
Source = (ToBeTranslated as text, TargetLang as text) =>
let
// Define the URL for the API endpoint
url = "https://translation.googleapis.com",
// Define the request headers
headers = [
#"Authorization" = "Bearer TokenHere",
#"x-goog-user-project" = "ProjectNameHere",
#"Content-Type" = "application/json; charset=utf-8"
],
path = "/language/translate/v2",
// Define the request body
body = Json.FromValue([
q = {ToBeTranslated},
target = TargetLang
]),
// Make the POST request
response = Web.Contents(url, [
Headers = headers,
RelativePath = path,
Content = body
]),
// Parse the JSON response
jsonResponse = Json.Document(response),
// Parse the JSON response
data = jsonResponse[data],
// Parse the JSON response
translations = data[translations],
// Parse the JSON response
translations1 = translations{0},
#"Converted to Table" = Record.ToTable(translations1),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "translatedText")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows", {"Name"})
in
#"Removed Columns"
in
Source
Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code
Regards,
Xiaoxin Sheng
Hi @hgarciaf ,
Can you please share some more detail information about this issue? They should help us clarify your scenario and test to troubleshoot.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |