Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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...).
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)?
Solved! Go to Solution.
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.
Regards,
Jimmy Tao
Hi Meer_C,
Have you solved your issue by now? If you have, could you please kindly mark my answer?
Regards,
Jimmy Tao
Hi Meer_C,
Have you solved your issue by now? If you have, could you please kindly mark my answer?
Regards,
Jimmy Tao
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
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!
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.
Regards,
Jimmy Tao