Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hello all,
The API i'm trying to get info from is : https://avisi-apps.gitbook.io/tracket/api/worklog-api
Which basically returns in a JSON format worklogs that employees did.
First I have to get a Bearer Token to authenticate, this part is done.
But I have another issue for paginate other this until the end.
I have an error that blocks me, I think I did the most of it but still missing a point here.
For the moment I have only 2 pages which I get like :
I do this that way because we have a cursor id in all pages except the last one which next-cursor is equal to null.
I basically want a way to fetch all pages until he gets no next-cursor or a next-cursor equals to null which means that's the last page.
Here is my code :
Source = Json.Document(Web.Contents("https://v1-gateway-9e6mvodx.uk.gateway.dev/api/1.0/worklogs",[Headers = [#"Content-Type"="application/json", #"Authorization"=token]])),
#"Converted to Table" = Record.ToTable(Source),
#"Transposed to Table" = Table.Transpose(#"Converted to Table"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed to Table", [PromoteAllScalars=true]),
data = let
Pagination = List.Generate( ()=> Source,
each [worklogs] <> null,
each
if Record.HasFields(_, "next-cursor")
then Json.Document(Web.Contents("https://v1-gateway-9e6mvodx.uk.gateway.dev/api/1.0/worklogs?next=" & Text.From([#"next-cursor"]), [Headers=[Authorization=token]] ))
else
if [#"next-cursor"] = null
then Json.Document(Web.Contents("https://v1-gateway-9e6mvodx.uk.gateway.dev/api/1.0/worklogs", [Headers=[Authorization=token]] ))
else Record.FromList({null, null}, {"worklogs", "next-cursor"} ))
in
Pagination,
#"Converted to Table1" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"worklogs", "next-cursor"}, {"worklogs", "next-cursor"})
in
#"Expanded Column1"
Let me know if it's unclear or you need more information,
VB
Solved! Go to Solution.
Hello all,
Instead of deleting my answer, I've found the solution here : https://community.powerbi.com/t5/Power-Query/Web-based-cursor-pagination-issue/m-p/2784393
Good luck
Hello all,
Instead of deleting my answer, I've found the solution here : https://community.powerbi.com/t5/Power-Query/Web-based-cursor-pagination-issue/m-p/2784393
Good luck
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |