Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi !
I want to take data from API with an automatique id loop.
let
BaseUrl = "https://ecofac.nicoka.com/api/jobs/",
Token = "token",
GetJson = (Url) =>
let Options = [Headers=[ #"Authorization" = "Bearer " & Token ]],
RawData = Web.Contents(Url, Options),
Json = Json.Document(RawData)
in Json,
GetTotalEntities = () =>
let Json = GetJson(BaseUrl),
Total = Json[total]
in Total,
GetUrl = (Index) =>
let Skip = Text.From(Index) & "/counters/",
Url = BaseUrl & Skip
in Url,
EntityCount = List.Max({GetTotalEntities()}),
PageCount = Number.RoundUp(EntityCount),
PageIndices = { 32 .. PageCount + 1 },
URLs = List.Transform(PageIndices, each GetUrl(_)),
Entities = List.Union(URLs)
in
Entities
Thanks for read this and for your helps if you can 😉
Solved! Go to Solution.
I don't need this list union 😮
I just missed to add this line on the GetUrl
Json = GetJson(Url),
Thank you for yours help 🙂
try replacing thjis
URLs = List.Transform(PageIndices, each GetUrl(_)),
Entities = List.Union(URLs)
in
Entities
with this one
URLs = List.Transform(PageIndices, each GetUrl(_))
in
URLs
PS
be careful not to leave the comma before in
When I do what you say I just have my address list that I want to request which it doesn't do.
Best regards
my suggestion was related to the error you reported. I have not read and understood the meaning and purpose of your code to give a complete answer (I don't have time to do such a thing).
I only saw that you improperly used the list.union function and suggested that you exclude it to get a correct but incomplete result.
<<can't convert the value "https://ecofac.nicoka..." in type list.>>
I'm sorry if the suggestion is not enough to completely solve your problem.
Yeah, I think I have to use a list.union to request my whole list to get all the data.
But this line doesn't actually work.
this is more or less what list.union can do:
https://docs.microsoft.com/it-it/powerquery-m/list-union
I don't need this list union 😮
I just missed to add this line on the GetUrl
Json = GetJson(Url),
Thank you for yours help 🙂
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 13 | |
| 11 | |
| 8 | |
| 7 | |
| 6 |