Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
nojust1
Frequent Visitor

Calling web service with result from another web service

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.

3 REPLIES 3
lbendlin
Super User
Super User

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.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors