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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Regular Visitor


Hola Comunidad,

Estoy trabajando con la version gratuita de Power BI desktop, intentando conectarme una API para la descarga de un archivo JSON.

Me compartieron el siguiente codigo que me esta arrojando el siguiente error:




La consulta que ejecute fue la siguiente


token1 = "Basic " & Binary.ToText(Text.ToBinary("Demo:z5BI%OImmQ#2"), 0),
url = "",
body = "{ ""client_id"": ""****"", ""client_secret"": ""****"", ""grant_type"": ""****"", ""audience"":""****""}",

tokenResponse = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json",#"Authorization"=token1], Content = Text.ToBinary(body) ] )),

BearerToken = "Bearer " & tokenResponse[access_token],

url_data = "",
File = Json.Document(Web.Contents(url_data,[Headers = [#"Content-Type"="application/json",#"Authorization"=BearerToken], Content = Text.ToBinary(body) ] )),

#"Convertido en tabla" = Record.ToTable(File) in #"Convertido en tabla"



Por favor si alguien me puede ayudar a revisar mi codigo 



Regular Visitor

Hello Jing,

The ir another way to check the BearerToken?

I only have one applied step in this new query i made




Hi @felipehr 


Can you open Advanced Editor of the new query and capture a screenshot or paste its M code here after removing sensitive information? From the current code you shared, you should have several steps "token1", "url", "body"... "Convertido en tabla". We need to know what's the query like currently. 


Best regards,




Hi Jing

This is the screen shot


Captura de pantalla 2023-03-21 100423.png

Thanks for your help



Hi @felipehr 


Please remove the codes I have covered with grey rectangles. For those red-underlined strings, you need to provide valid values for them. If you don't know what to provide for them, you need to ask the API provider or the person who shares this code with you for these information. These information is required by the API for authentication. 



Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Thanks Jing

I got the following error

Captura de pantalla 2023-03-23 102147.png

Please could you confirm I remove it right

Captura de pantalla 2023-03-23 090703.png

I left it like this


token1 = "Basic " & Binary.ToText(Text.ToBinary(), 0),
url = "",
body = "{ ""client_id"": , ""client_secret"": , ""grant_type"": , ""audience"":}",



Best regards




This is the information i got about the API


Captura de pantalla 2023-03-23 163411.png

Community Support
Community Support

Hi @felipehr 


It seems the token is perhaps not valid. In Power Query Editor, there is a Query Settings pane at the right most side which has all steps listed in "APPLIED STEPS". Can you click on the "BearerToken" step or the "tokenResponse" step to check whether you get a token successfully at this step?


Best Regards,
Community Support Team _ Jing


Helpful resources

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors