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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
w_soham_more
Frequent Visitor

Error while parsing API response in Power Query

Hi all,

 

I am trying to parse the API response in Power Query and use the response as a table in Power BI. 

The data is paginated, and that's why I am using the List.Generate function along with a custom function that calls the API. I think I have got most of it right, however I am receiving the following error: 

 

w_soham_more_0-1723178850291.png

 

This is the query I am using:

 

= let
Source = List.Generate(
[Result = Query1("url"),
],
each [Result][next_page_url] <> null,
each [Query1([Result][next_page_url])],
each [Result][results]
)
in
Source

 

 

I have tested the Query1 function with the URL and it returns the following response for a single page:

w_soham_more_1-1723179168746.png

 

How do I resolve this issue? I think the function is expecting records, whereas the results is of type List.

1 ACCEPTED SOLUTION
ahadkarimi
Solution Specialist
Solution Specialist

Hey @w_soham_more
Try this code and let me know if there are any problems.

let
Source = List.Generate(
() => [Result = Query1("url")],
each [Result] <> null and Record.HasFields([Result], "next_page_url") and [Result][next_page_url] <> null,
each [Result = Query1([Result][next_page_url])],
each [Result][results]
)
in
Source

View solution in original post

4 REPLIES 4
ahadkarimi
Solution Specialist
Solution Specialist

Hey @w_soham_more
Try this code and let me know if there are any problems.

let
Source = List.Generate(
() => [Result = Query1("url")],
each [Result] <> null and Record.HasFields([Result], "next_page_url") and [Result][next_page_url] <> null,
each [Result = Query1([Result][next_page_url])],
each [Result][results]
)
in
Source

Hi @ahadkarimi, Thanks a lot for this. This worked perfectly. Really appreciate the help.

@w_soham_more You're welcome! I'm glad it worked for you.

robert245
New Member


@w_soham_more wrote:

Hi all,

 

I am trying to parse the API response in Power Query and use the response as a table in Power BI. 

The data is paginated, and that's why I am using the List.Generate function along with a custom function that calls the API. I think I have got most of it right, however I am receiving the following error:  GMSocrates

 

w_soham_more_0-1723178850291.png

 

This is the query I am using:

 

 

 

= let
Source = List.Generate(
[Result = Query1("url"),
],
each [Result][next_page_url] <> null,
each [Query1([Result][next_page_url])],
each [Result][results]
)
in
Source

 

 

 

 

I have tested the Query1 function with the URL and it returns the following response for a single page:

w_soham_more_1-1723179168746.png

 

How do I resolve this issue? I think the function is expecting records, whereas the results is of type List.


Hello,

I’m also encountering issues parsing API responses in Power Query. I’m using the List.Generate function for paginated data, but I’m running into errors where the expected record type doesn’t match the actual list type being returned.

If anyone has insights or solutions, I’d greatly appreciate your help.

 

Best regards,
robert245

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.