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
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Power BI Dev Camp Session 27

Ted's Dev Camp

This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.