cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Community Support
Community Support

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

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

Community Support
Community Support

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

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
Community Support
Community Support

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

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

Community Support
Community Support

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

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

Meer_C
Regular Visitor

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

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!

Meer_C
Regular Visitor

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

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!

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.