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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NiharTestIngram
Regular Visitor

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

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

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?

Anonymous
Not applicable

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

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

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

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

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors