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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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