Forum Discussion
Scheduled Refresh Custom Function
- 8 years ago
It looks like you may be running into the issue I describe here:
Can you try rewriting so that Web.Contents uses the Query option for your parameters?
Chris
- 8 years ago
Ah, I didn't see that you are doing authentication using a header - no, I don't think it will work (see the comment by danzrust on the blog post). Sorry!
Chris
Hi Soldexio,
AFAIK, current power bi service still not support custom function, please convert your query to parameterized query instead custom function.
Remove top row and define param1, param2 as query parameters with accurate parameter type:
let
Source = Json.Document(Web.Contents("URL" & "ParamX=" & param1 & "&ParamY=" & param2 , [Headers=[Authorization="Bearer " & #"Authorization Token"]]))
in
Source
BTW, current query parameters with 'any' type not allow to changed on power bi service side.
Regards,
Xiaoxin Sheng
Hi Anonymous,
Alright good to know I can translate each query to a parameterized query. However, I did this test for one of the queries and when I try to schedule a refresh now I get:
Failed to update data source credentials: The credentials provided for the Web source are invalid. (Source at <URL>.)Hide details
| Activity ID: | b46998c5-dd70-47c2-ac52-2c7095e5dbec |
| Request ID: | 4d4f0423-8fbe-3ad3-c487-4914e391ca35 |
| Status code: | 400 |
| Time: | Tue Aug 21 2018 08:51:03 GMT+0200 (Central European Summer Time) |
| Version: | 13.0.6358.131 |
| Cluster URI: | https://wabi-europe-north-b-redirect.analysis.windows.net |
The data is loading perfectly within Power BI never have any problems, but when I try to schedule a refresh it fails. Any tips to this?
- Soldexio8 years ago
Helper I
Hi @v-shex-msft,
I did some testing with webhook tester. The request that the Power BI service is sending, is not sending the authorization token properly.
host webhook.site user-agent Microsoft.Data.Mashup (https://go.microsoft.com/fwlink/?LinkID=304225) authorization Bearer content-length (empty) content-type (empty)
Any idea to why this is and how to fix this? Because this is the reason every request on my side is failing when I translate it to parameterized query. The request within Power BI is as follows:
Headers
connection Keep-Alive host webhook.site accept-encoding gzip, deflate user-agent Microsoft.Data.Mashup (https://go.microsoft.com/fwlink/?LinkID=304225) accept */* authorization Bearer 12345 content-length (empty) content-type (empty) Any help here would be welcome!