Forum Discussion
rdorsey
1 year agoFrequent Visitor
Using List.Generate for Token-Based API Call
This is my first time building something like this and I'm missing something really fundamental. I built a function in M called "Output" which takes text as a parameter and runs an API call using ...
- 1 year ago
Your syntax doesn't look right to me.
Compare to the examples in this highly-related article:
How to use List.Generate to make API Calls in Power Query MCode snippet from the article:
List.Generate( () => [ Offset = 100, Pokemon = GetPokemon(0) ], each [Offset] <= 200, each [ Pokemon = GetPokemon( [Offset] ), Offset = [Offset] + 100 ], each [Pokemon] )Your code should probably look more like this:
List.Generate( () => [ token = "", results = Output("") ], each [results][EarliestEntryDate] > Date.FromText("6/15/2025"), each [ token = [results][continuationToken], results = Output(token) ], each [results] )
AlexisOlson
Super User
1 year agoYour syntax doesn't look right to me.
Compare to the examples in this highly-related article:
How to use List.Generate to make API Calls in Power Query M
Code snippet from the article:
List.Generate(
() => [ Offset = 100, Pokemon = GetPokemon(0) ],
each [Offset] <= 200,
each [ Pokemon = GetPokemon( [Offset] ), Offset = [Offset] + 100 ],
each [Pokemon]
)
Your code should probably look more like this:
List.Generate(
() => [ token = "", results = Output("") ],
each [results][EarliestEntryDate] > Date.FromText("6/15/2025"),
each [ token = [results][continuationToken], results = Output(token) ],
each [results]
)