Reply
NiharTestIngram
Regular Visitor
Partially syndicated - Outbound

The 'Authorization' header is only supported when connecting anonymously from sonar cloud API

Hi Team,

 

I am getting below error while trying to fetch data from sonar cloud API using basic authentication. where as same API is working fine in postman. can someone help me on how to resolve this for all repository.

 

I tried different forums where it's mentioned to used datasource connection as anonymous. but there also i am getting issue 

NiharTestIngram_0-1670326596036.png

Then i tried with with basic authentication but getting the Authorization header error for all repositories.

NiharTestIngram_1-1670326683559.pngNiharTestIngram_2-1670326707074.png

Tried this query

= Json.Document(Web.Contents("https://sonarcloud.io/api/measures/component?component=imonline_accountmanagement.webapi.reseller&me...", [Headers=[Authorization="Basic NGZhNmFkZDFhNmMyNDRkMjdlNjI0MDVjYTQ3YWJmNjhmNzdiYjI0Njo="]]))

 

can you please help me here how to solve this issue.

 

Thanks

Nihar Arisal

1 ACCEPTED SOLUTION
NiharTestIngram
Regular Visitor

Syndicated - Outbound

HI @Daryl-Lynch-Bzy ,

 

Its now working. i just removed authorization from power query as token is used for data source connection.

 

let
Source = Json.Document(Web.Contents("https://sonarcloud.io/api/measures/component?component=imonline_accountmanagement.webapi.reseller&me...")),
#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded component" = Table.ExpandRecordColumn(#"Converted to Table", "component", {"id", "key", "name", "qualifier", "measures"}, {"component.id", "component.key", "component.name", "component.qualifier", "component.measures"}),
#"Expanded component.measures" = Table.ExpandListColumn(#"Expanded component", "component.measures"),
#"Expanded component.measures1" = Table.ExpandRecordColumn(#"Expanded component.measures", "component.measures", {"metric", "value", "bestValue"}, {"component.measures.metric", "component.measures.value", "component.measures.bestValue"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded component.measures1",{{"component.id", type text}, {"component.key", type text}, {"component.name", type text}, {"component.qualifier", type text}, {"component.measures.metric", type text}, {"component.measures.value", Int64.Type}, {"component.measures.bestValue", type logical}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"component.id", "component.key", "component.qualifier","component.measures.bestValue"})
in
#"Removed Columns"

 

Thanks

Nihar

View solution in original post

5 REPLIES 5
Nari1998
Helper II
Helper II

Syndicated - Outbound

Hi all,

 

i have the same issue with fetching EHS insights data from API. the refresh in powerbi service wont work and gives the same message. 

I tried removing the header and then swithing to basic authentication by using my username and the API key for te key after that i published the file. i also changed the data source credentials to same what i did in the desktop file but when i then refresh, i still seem to get the error.

Any help?

avatar user
Anonymous
Not applicable

Syndicated - Outbound

Hi @NiharTestIngram - I am having a similar issue with a different API. Would you mind demonstrating where and how exactly you removed the authorization bit from the query? I know it's been awhile. Thank you in advance

NiharTestIngram
Regular Visitor

Syndicated - Outbound

HI @Daryl-Lynch-Bzy ,

 

Its now working. i just removed authorization from power query as token is used for data source connection.

 

let
Source = Json.Document(Web.Contents("https://sonarcloud.io/api/measures/component?component=imonline_accountmanagement.webapi.reseller&me...")),
#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded component" = Table.ExpandRecordColumn(#"Converted to Table", "component", {"id", "key", "name", "qualifier", "measures"}, {"component.id", "component.key", "component.name", "component.qualifier", "component.measures"}),
#"Expanded component.measures" = Table.ExpandListColumn(#"Expanded component", "component.measures"),
#"Expanded component.measures1" = Table.ExpandRecordColumn(#"Expanded component.measures", "component.measures", {"metric", "value", "bestValue"}, {"component.measures.metric", "component.measures.value", "component.measures.bestValue"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded component.measures1",{{"component.id", type text}, {"component.key", type text}, {"component.name", type text}, {"component.qualifier", type text}, {"component.measures.metric", type text}, {"component.measures.value", Int64.Type}, {"component.measures.bestValue", type logical}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"component.id", "component.key", "component.qualifier","component.measures.bestValue"})
in
#"Removed Columns"

 

Thanks

Nihar

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Syndicated - Outbound

Hi @NiharTestIngram  - can you please try wraping Authorization with #"" so it appears as #"Authorization"? 

Syndicated - Outbound

HI @Daryl-Lynch-Bzy ,

I tried with that option also but same result.

let
Source = Json.Document(Web.Contents("https://sonarcloud.io/api/measures/component?component=imonline_accountmanagement.webapi.reseller&me...", [Headers=[#"Authorization"="Basic NGZhNmFkZDFhNmMyNDRkMjdlNjI0MDVjYTQ3YWJmNjhmNzdiYjI0Njo="]])),
#"Converted to Table" = Table.FromRecords({Source}),
#"Expanded component" = Table.ExpandRecordColumn(#"Converted to Table", "component", {"id", "key", "name", "qualifier", "measures"}, {"component.id", "component.key", "component.name", "component.qualifier", "component.measures"}),
#"Expanded component.measures" = Table.ExpandListColumn(#"Expanded component", "component.measures"),
#"Expanded component.measures1" = Table.ExpandRecordColumn(#"Expanded component.measures", "component.measures", {"metric", "value", "bestValue"}, {"component.measures.metric", "component.measures.value", "component.measures.bestValue"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded component.measures1",{{"component.id", type text}, {"component.key", type text}, {"component.name", type text}, {"component.qualifier", type text}, {"component.measures.metric", type text}, {"component.measures.value", Int64.Type}, {"component.measures.bestValue", type logical}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"component.id", "component.key", "component.qualifier","component.measures.bestValue"})
in
#"Removed Columns"

NiharTestIngram_0-1670394422607.png

NiharTestIngram_1-1670394764027.pngNiharTestIngram_2-1670394783848.png

 

Getting same issue for all the. and using same basic auth, it is working fine in postman. but not in power BI.

for that error it did not allow me to apply the changes as well.

NiharTestIngram_3-1670396094465.png

 

 

Thanks

Nihar

 

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)