Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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:
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:
How do I resolve this issue? I think the function is expecting records, whereas the results is of type List.
Solved! Go to Solution.
Hey @Anonymous,
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
Hey @Anonymous,
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.
@Anonymous You're welcome! I'm glad it worked for you.
@Anonymous 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
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:
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |