Forum Discussion
Anonymous
4 years agoNot applicable
Struggling with the cyclic reference error
I have coded the following function, which recursively calls itself in order to retrieve the full list of users from a REST API: let
GetUserData = (startFrom as number, uCount as number, res...
- 4 years ago
Your first steps are correct
let userCount = Json.Document(Web.Contents("https://storfolloikt.pureservice.com/agent/api/user/count", [ Headers=[ Accept="application/vnd.api+json", #"X-Authorization-Key"= Text.From(#"PUSapikey") ] ]))[count], pages = Number.RoundUp(userCount / 500),but then you veer off track. Next step is to create a list with all the URLs you need to fetch the data chunks.
since you already know the number of pages you need there is not really a reason to use list.generate any more. A simple
{1..pages}
is enough. Convert that to a table, add your GetUserData function as a custom column, and combine the output.
Anonymous
4 years agoNot applicable
That looks promising. Thanks for the tip! However, I have seen a lot of examples with recursion. How do you get this to work without triggering a cyclic reference error?