cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Meer_C
Regular Visitor

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

4 REPLIES 4
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

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,

 

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

View solution in original post

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!