The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have a Power Query where the final result web service query needs to be called using the result of another web service.
The first call is necessary to generate what's called a JobId. This JobId is then used to pull data.
I'm getting the JobId successfully but when I try to run the final query I get a Bad Request error. The reason for the error is the job is not completed. These requests typically take less than a second or two.
Seems like the simple solution would be to delay running the final query so I've tried to run it with Function.InvokeAfter. It sill fails.
Could the issue be that the root url for both is the same?
Here's the syntax I'm using.
let
body = "{""getMyStuff"":true,""}",
data =Web.Contents("MyUrl",[Content=Text.ToBinary(body),Headers=[#"apikey"="mykey"]]),
DataRecord = Json.Document(data),
testJobId=DataRecord[jobId],
getAPI = ()=> Csv.Document(Web.Contents("MyUrl/getjob/"&testJobId&"/results", [Headers=[apikey="mykey"]]),[Delimiter=",", Columns=12, Encoding=65001, QuoteStyle=QuoteStyle.None]),
Source = Function.InvokeAfter(getAPI, #duration(0,0,0,30)),
in
Source
Any help is greatly appreciated.
You likely need to hand "testJobId" over to "getAPI" as a parameter, or specify the scope.
Thanks for the response. Unfortunately I've tried setting testJobId as a parameter but I get the following.
Formula.Firewall: Query 'JobId Forecast EDA' (step 'Filtered Rows') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.
You didn't mention that you need this to work in the service. There are multiple articles that describe how to defeat the formula firewall dragon - pick the approach you like best. Read about Power Query partitions.
User | Count |
---|---|
65 | |
60 | |
55 | |
53 | |
30 |
User | Count |
---|---|
180 | |
88 | |
72 | |
48 | |
46 |