Forum Discussion
MOVC
3 years agoResolver I
Web.Contents working in Power Query but not on Load
I am running a simple HTTP request to return a CSV from a service. I first use the Source step to request that a report is run, I then parse the output to get a runId variable which I then plug into the main request. Since the report takes 10-15 seconds to run i use the Function.InvokeAfter to be sure it's done before I get the report.
let
Source = Json.Document(Web.Contents("url to run the report", [Headers=[#"Content-Type"="type", Accept="type", Authorization="API key"], Content=Text.ToBinary("body method")])),
params = Source[params],
runId = Text.From(params[runId]),
doc = Function.InvokeAfter( () => Csv.Document(Web.Contents("url to get the report"&runId&".csv", [Headers=[#"Content-Type"="type", Authorization="API key"]]),[Delimiter=",", Columns=33, Encoding=65001, QuoteStyle=QuoteStyle.Csv]),#duration(0,0,1,0))
in
doc
This works as expected in the Power Query window returning the report. However every time I close and load into the Report Builder I get a 404 error:
I assumed it was to do with the wait time but I changed it to 5 and 10 minutes which made no difference (while still returning correctly in Power Query after the delay).
Any suggestions? What could cause difference behavior outside of Power Query?
No RepliesBe the first to reply