Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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
let
token1 = "Basic " & Binary.ToText(Text.ToBinary("Demo:z5BI%OImmQ#2"), 0),
url = "https://adamchile.com/authenticar/",
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 = "https://madainqsol.com/listadoDeBodegas/",
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
Saludos
Hello Jing,
The ir another way to check the BearerToken?
I only have one applied step in this new query i made
Regards
Felipe
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,
Jing
Hi Jing
This is the screen shot
Thanks for your help
Felipe
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
Please could you confirm I remove it right
I left it like this
...
token1 = "Basic " & Binary.ToText(Text.ToBinary(), 0),
url = "https://adamchile.com/authenticar/",
body = "{ ""client_id"": , ""client_secret"": , ""grant_type"": , ""audience"":}",
Best regards
Felipe
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
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
33 | |
16 | |
12 | |
11 | |
9 |
User | Count |
---|---|
44 | |
24 | |
16 | |
14 | |
14 |