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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors