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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register 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
Super User
Super User

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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.