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
rickteachey
New Member

Combine multiple API calls into one result

Hello, I am cross posting this question from SO.

 

I'm using an API (for a project management database) that returns a result in the following form (in JSON format):
 
```json
{'Content':
{
'Projects': ['project1', 'project2', 'project3', 'project4'],
'InvoiceGroups': ['group1', 'group2', 'group3', 'group4'],
'Phases': ['phase1', 'phase2', 'phase3', 'phase4'],
'Resources': ['resource1', 'resource2', 'resource3', 'resource4'],
}
}
```
 
NOTE: in reality there are tens of thousands of entries in each of these inner/nested lists; and each entry is actually not a string but a JSON object (i.e., Power Query record).
 
The API limits the database request to about 2000 projects at a time, so I have to break the request up into chunks. So instead of getting a single JSON object (PQ record) back with the entire response, I am getting multiple of them in a list.
 
So I have something like this, which is a list of JSON objects (PQ list of PQ records):
 
```json
[
{
'Content':
{
'Projects': ['project1'],
'InvoiceGroups': ['group1'],
'Phases': ['phase1'],
'Resources': ['resource1'],
}
},
{
'Content':
{
'Projects': ['project2'],
'InvoiceGroups': ['group2'],
'Phases': ['phase2'],
'Resources': ['resource2'],
}
},
{
'Content':
{
'Projects': ['project3'],
'InvoiceGroups': ['group3'],
'Phases': ['phase3'],
'Resources': ['resource3'],
}
},
{
'Content':
{
'Projects': ['project4'],
'InvoiceGroups': ['group4'],
'Phases': ['phase4'],
'Resources': ['resource4'],
}
},
]
```
 
My question is: how can I write an efficient Power Query function to recombine these separate responses back into the original response, with the nested lists recombined the way they should be?
 
I attempted just using the `Record.Combine` function, but it does not work:
 
```powerquery
let
    recombined = Record.Combine(list_of_records)
in
    recombined
```
 
(NOTE: I'd prefer to do this in Python but for reasons I won't go into, we do need to do this in PQ.)
1 REPLY 1
lbendlin
Super User
Super User

your sample is not well-enough formed JSON to be usable. Can you please adjust it?

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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 Kudoed Authors