cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gtrani
Frequent Visitor

Can't connect to public API

Hi everyone!

 

I'm trying to connect Power BI desktop to a public API from Brazilian Government, but the "can't stablish connection" message pops-up:

gtrani_0-1661463416999.png

 

gtrani_1-1661463513728.png

 

Can't stablish connectionCan't stablish connection

 

 

The page that generates the data is:

https://sidra.ibge.gov.br/tabela/7060#notas-tabela

 

And the API link in generated down below, in the "chain" symbol, with this link:

https://apisidra.ibge.gov.br/values/k/-1969147900

 

Any clues of what am I doing wrong??

 

Thank you!

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You need to specify your actual query parameters according to the documentation at Home Page da API Sidra (ibge.gov.br)

 

 

let
    Source = Json.Document(Web.Contents("https://apisidra.ibge.gov.br/values/t/7060/p/202207/n1/all")),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"NC", "NN", "MC", "MN", "V", "D1C", "D1N", "D2C", "D2N", "D3C", "D3N", "D4C", "D4N"}, {"NC", "NN", "MC", "MN", "V", "D1C", "D1N", "D2C", "D2N", "D3C", "D3N", "D4C", "D4N"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"NC", type text}, {"NN", type text}, {"MC", type text}, {"MN", type text}, {"V", type text}, {"D1C", type text}, {"D1N", type text}, {"D2C", type text}, {"D2N", type text}, {"D3C", type text}, {"D3N", type text}, {"D4C", type text}, {"D4N", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Nível Territorial (Código)", Int64.Type}, {"Nível Territorial", type text}, {"Unidade de Medida (Código)", Int64.Type}, {"Unidade de Medida", type text}, {"Valor", type number}, {"Mês (Código)", Int64.Type}, {"Mês", type text}, {"Brasil (Código)", Int64.Type}, {"Brasil", type text}, {"Variável (Código)", Int64.Type}, {"Variável", type text}, {"Geral, grupo, subgrupo, item e subitem (Código)", Int64.Type}, {"Geral, grupo, subgrupo, item e subitem", type text}})
in
    #"Changed Type1"

 

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

You need to specify your actual query parameters according to the documentation at Home Page da API Sidra (ibge.gov.br)

 

 

let
    Source = Json.Document(Web.Contents("https://apisidra.ibge.gov.br/values/t/7060/p/202207/n1/all")),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"NC", "NN", "MC", "MN", "V", "D1C", "D1N", "D2C", "D2N", "D3C", "D3N", "D4C", "D4N"}, {"NC", "NN", "MC", "MN", "V", "D1C", "D1N", "D2C", "D2N", "D3C", "D3N", "D4C", "D4N"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Column1",{{"NC", type text}, {"NN", type text}, {"MC", type text}, {"MN", type text}, {"V", type text}, {"D1C", type text}, {"D1N", type text}, {"D2C", type text}, {"D2N", type text}, {"D3C", type text}, {"D3N", type text}, {"D4C", type text}, {"D4N", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Nível Territorial (Código)", Int64.Type}, {"Nível Territorial", type text}, {"Unidade de Medida (Código)", Int64.Type}, {"Unidade de Medida", type text}, {"Valor", type number}, {"Mês (Código)", Int64.Type}, {"Mês", type text}, {"Brasil (Código)", Int64.Type}, {"Brasil", type text}, {"Variável (Código)", Int64.Type}, {"Variável", type text}, {"Geral, grupo, subgrupo, item e subitem (Código)", Int64.Type}, {"Geral, grupo, subgrupo, item e subitem", type text}})
in
    #"Changed Type1"

 

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors