Forum Discussion

gtrani's avatar
gtrani
Frequent Visitor
4 years ago
Solved

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:

 

 

Can'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!

  • 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"

     

1 Reply

  • 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"