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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Refresh of web source through on-premise gateway gives 405 error

I'm trying to refresh data for 1 query from a web source, that sends a API-request for a token first, and then uses this token to send a second request to load data. The Power Query is: 

 

 
let
	url = "http://someurl/api/Account/Token",
	body = "{ 
	   ""userName"": ""name"",
""password"": ""password"" }", Parsed_Json = Json.Document(body), BuildQueryString = Uri.BuildQueryString(Parsed_Json), Bron = Json.Document(Web.Contents(url, [Headers=[#"Content-Type"="application/json-patch+json;v=1.1", Accept="application/json"], Content = Text.ToBinary(body)])), #"access_token" ="bearer "& Bron[token], url2 = "http://someurl/api/Currency/GetCurrencyCodes", Bron2 = Json.Document(Web.Contents(url2, [Headers=[Accept="application/json", Authorization=#"access_token"]])), #"Geconverteerd naar tabel" = Table.FromList(Bron2, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"TabelValuta" = Table.ExpandRecordColumn(#"Geconverteerd naar tabel", "Column1", {"currencyCode", "description", "rate", "isoCode"}, {"Valutacode", "Omschrijving", "Koers", "ISO"} )
in #"TabelValuta"

While refreshing in Power BI works great, I get a reference error when I try to refresh through Power BI Service. 

 

 

The Personal Gateway Status is green.

 

However, under Dataset references, I get a reference-error, displaying two separate Web reference errors (see image, in Dutch...).

Reference error.JPG

When I try to edit the references I get the error: Web.Contents fails to load content from 'url/api/account/token' (405): Method Not Allowed'. I guess that this leads to a reference error for the second API request (url = "http://someurl/api/Currency/GetCurrencyCodes"). Both have Anonymous verification, as required and working in Power BI Desktop refresh.

 

Does anyone have a clue what I'm doing or is going wrong here? Maybe it's the first url to request the token? If so, how should I change this so that refreshing will work (as in Power BI Desktop)?

2 ACCEPTED SOLUTIONS
v-yuta-msft
Community Support
Community Support

Hi Meer_C,

 

In power bi desktop, from the Data Source Settings dialog, select the data source(s) and then select Edit Permissions... and ensure that the Privacy Level is set to Public.

python-in-query-editor-10.png 

 

Regards,

Jimmy Tao

View solution in original post

v-yuta-msft
Community Support
Community Support

Hi Meer_C, 

 

Have you solved your issue by now? If you have, could you please kindly mark my answer?

 

Regards,

Jimmy Tao

View solution in original post

5 REPLIES 5
v-yuta-msft
Community Support
Community Support

Hi Meer_C, 

 

Have you solved your issue by now? If you have, could you please kindly mark my answer?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

Issue is solved now, the setting for the datasource in Power BI Service within the datagateway cluster was not correct . Thank you Jimmy for the offered solution!

Hello Jimmy

 

Would you give me more information about your solution? 

 

Thanks

 

Greetings 

Anonymous
Not applicable

Hello Jimmy,

 

Sorry, due to the Holiday season I wasn't able to reply earlier. Thank you for your suggested solution, but unfortunately this issue remains the same. I've changed the dataset permisions to public, and even deleted the dataset in Power Bi service and the republished it from Power BI desktop to be sure. So references are Anonymous, Privacy setting is now Public. Still the same problem.

 

 

Any other suggestion perhaps?

 

Thank you for your help!

v-yuta-msft
Community Support
Community Support

Hi Meer_C,

 

In power bi desktop, from the Data Source Settings dialog, select the data source(s) and then select Edit Permissions... and ensure that the Privacy Level is set to Public.

python-in-query-editor-10.png 

 

Regards,

Jimmy Tao

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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