This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
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
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |