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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
ScottF
Frequent Visitor

How can an API query reference another API query?

I'm making API calls to a call tracking service called ResponseTap. Their API allows you to return a list of many call IDs (e.g. clarity-us4-1459508541.810585), but with no further details such as call duration, source, etc. In a different type of call, I'm able to return full call details, but only for a single call ID. I would like to pull full call details (like the second API call) but for multiple call IDs (like the first API call). 

 

API Call 1 (multiple call IDs, no details)

 

let
Source = Xml.Tables(Web.Contents("https://dashboard.responsetap.com/api/1/accounts/5482/cdrids?fromDate=2016-04-01&toDate=2016-04-05")),
Table0 = Source{0}[Table],
Table1 = Table0{0}[Table],
#"Changed Type" = Table.TransformColumnTypes(Table1,{{"Element:Text", type text}})
in
#"Changed Type"

 

 

API Call 2 (single call ID, full details)

 

let
Source = Xml.Tables(Web.Contents("https://dashboard.responsetap.com/api/1/accounts/5482/fullCallRecords/clarity-us4-1459508541.810585")),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"cdrId", type text}, {"customerNumber", Int64.Type}, {"trackingNumber", Int64.Type}, {"businessNumber", Int64.Type}, {"campaignName", type text}, {"callDate", type datetime}, {"callDuration", Int64.Type}, {"callTalkTime", Int64.Type}, {"disposition", type text}, {"recorded", type logical}, {"sourceId", Int64.Type}, {"channelName", type text}, {"mediumName", type text}, {"mediumTypeName", type text}, {"numberGroupId", Int64.Type}, {"numberGroupName", type text}, {"callId", Int64.Type}})
in
#"Changed Type"

 

 

How could I replace the call ID in the second API call (clarity-us4-1459508541.810585) with a variable that would pull in call IDs from the first API call and report full call details for all of them? Thanks!

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

Here is a similar scenario that should help you out.

http://datachix.com/2014/05/22/power-query-functions-some-scenarios/

 

Basically, the concept is to turn your API Call 2 into a function that takes one or more parameters and then you call API Call 2 function for each row in API Call 1.

 

In your case, you may have to create multiple functions and custom columns that call those functions, or return everything in a comma-separated return value and then do a split on that column as a subsequent step in your API Call 1 query.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.