<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API REST Tracket Cursor Based Pagination in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/API-REST-Tracket-Cursor-Based-Pagination/m-p/3115826#M41595</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of deleting my answer, I've found the solution here : &lt;A href="https://community.powerbi.com/t5/Power-Query/Web-based-cursor-pagination-issue/m-p/2784393" target="_blank"&gt;https://community.powerbi.com/t5/Power-Query/Web-based-cursor-pagination-issue/m-p/2784393&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;</description>
    <pubDate>Tue, 07 Mar 2023 09:08:33 GMT</pubDate>
    <dc:creator>VBLOT</dc:creator>
    <dc:date>2023-03-07T09:08:33Z</dc:date>
    <item>
      <title>API REST Tracket Cursor Based Pagination</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-REST-Tracket-Cursor-Based-Pagination/m-p/3110039#M41525</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The API i'm trying to get info from is : &lt;A href="https://avisi-apps.gitbook.io/tracket/api/worklog-api" target="_blank" rel="noopener"&gt;https://avisi-apps.gitbook.io/tracket/api/worklog-api&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Which basically returns in a JSON format worklogs that employees did.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First I have to get a Bearer Token to authenticate, this part is done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I have another issue for paginate other this until the end.&lt;/P&gt;&lt;P&gt;I have an error that blocks me, I think I did the most of it but still missing a point here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the moment I have only 2 pages which I get like :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VBLOT_0-1677856937789.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/881091i1CAD9B0F1F59839D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VBLOT_0-1677856937789.png" alt="VBLOT_0-1677856937789.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; 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( ()=&amp;gt; Source,
    each [worklogs] &amp;lt;&amp;gt; null,
    each 
        if Record.HasFields(_, "next-cursor")
        then Json.Document(Web.Contents("https://v1-gateway-9e6mvodx.uk.gateway.dev/api/1.0/worklogs?next=" &amp;amp; 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"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if it's unclear or you need more information,&lt;/P&gt;&lt;P&gt;VB&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 15:33:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-REST-Tracket-Cursor-Based-Pagination/m-p/3110039#M41525</guid>
      <dc:creator>VBLOT</dc:creator>
      <dc:date>2023-03-03T15:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: API REST Tracket Cursor Based Pagination</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-REST-Tracket-Cursor-Based-Pagination/m-p/3115826#M41595</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of deleting my answer, I've found the solution here : &lt;A href="https://community.powerbi.com/t5/Power-Query/Web-based-cursor-pagination-issue/m-p/2784393" target="_blank"&gt;https://community.powerbi.com/t5/Power-Query/Web-based-cursor-pagination-issue/m-p/2784393&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 09:08:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-REST-Tracket-Cursor-Based-Pagination/m-p/3115826#M41595</guid>
      <dc:creator>VBLOT</dc:creator>
      <dc:date>2023-03-07T09:08:33Z</dc:date>
    </item>
  </channel>
</rss>

