<?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 Accessing a Record from API Source in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Accessing-a-Record-from-API-Source/m-p/2564913#M36562</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have built a custom connector for an API that sends its pagination data back in the body of the response, rather than the header. The way to use GetNextLink using header is documented in the GitHub custom connector example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/microsoft/DataConnectors/blob/master/samples/Github/github.pq" target="_self"&gt;https://github.com/microsoft/DataConnectors/blob/master/samples/Github/github.pq&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GetNextLink = (response, optional request) =&amp;gt;
    let
        // extract the "Link" header if it exists
        link = Value.Metadata(response)[Headers][#"Link"]?,
        links = Text.Split(link, ","),
        splitLinks = List.Transform(links, each Text.Split(Text.Trim(_), ";")),
        next = List.Select(splitLinks, each Text.Trim(_{1}) = "rel=""next"""),
        first = List.First(next),
        removedBrackets = Text.Range(first{0}, 1, Text.Length(first{0}) - 2)
    in
        try removedBrackets otherwise null;&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;Getting to the pagination data in the body of the reponse should be easier. But I am stumped.&amp;nbsp; In the images, you can see the record I am trying to access that comes back through Web.Contents()&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vimeo.png" style="width: 762px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/728342i41BF3182608B35AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="vimeo.png" alt="vimeo.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code for the GetNextLink function. I am trying to get the "next" record above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GetNextLink = (response) =&amp;gt;
// response is data already run through Web.Contents()

let
    Source = Lines.FromBinary(response),
    nextPage = Record.Field(Source[paging], "next")
in 
    try nextPage otherwise null;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the error back "&lt;SPAN&gt;We cannot convert a value of type Record to type Text". I feel like I am not getting the 'Source" correctly? I could certainly use help as I am a PowerQuery newbie!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2022 19:39:29 GMT</pubDate>
    <dc:creator>powerbitotheppl</dc:creator>
    <dc:date>2022-06-07T19:39:29Z</dc:date>
    <item>
      <title>Accessing a Record from API Source</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Accessing-a-Record-from-API-Source/m-p/2564913#M36562</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have built a custom connector for an API that sends its pagination data back in the body of the response, rather than the header. The way to use GetNextLink using header is documented in the GitHub custom connector example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/microsoft/DataConnectors/blob/master/samples/Github/github.pq" target="_self"&gt;https://github.com/microsoft/DataConnectors/blob/master/samples/Github/github.pq&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GetNextLink = (response, optional request) =&amp;gt;
    let
        // extract the "Link" header if it exists
        link = Value.Metadata(response)[Headers][#"Link"]?,
        links = Text.Split(link, ","),
        splitLinks = List.Transform(links, each Text.Split(Text.Trim(_), ";")),
        next = List.Select(splitLinks, each Text.Trim(_{1}) = "rel=""next"""),
        first = List.First(next),
        removedBrackets = Text.Range(first{0}, 1, Text.Length(first{0}) - 2)
    in
        try removedBrackets otherwise null;&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;Getting to the pagination data in the body of the reponse should be easier. But I am stumped.&amp;nbsp; In the images, you can see the record I am trying to access that comes back through Web.Contents()&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vimeo.png" style="width: 762px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/728342i41BF3182608B35AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="vimeo.png" alt="vimeo.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code for the GetNextLink function. I am trying to get the "next" record above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;GetNextLink = (response) =&amp;gt;
// response is data already run through Web.Contents()

let
    Source = Lines.FromBinary(response),
    nextPage = Record.Field(Source[paging], "next")
in 
    try nextPage otherwise null;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the error back "&lt;SPAN&gt;We cannot convert a value of type Record to type Text". I feel like I am not getting the 'Source" correctly? I could certainly use help as I am a PowerQuery newbie!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 19:39:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Accessing-a-Record-from-API-Source/m-p/2564913#M36562</guid>
      <dc:creator>powerbitotheppl</dc:creator>
      <dc:date>2022-06-07T19:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing a Record from API Source</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Accessing-a-Record-from-API-Source/m-p/2571351#M36630</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/385484"&gt;@powerbitotheppl&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try this function to transform it&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/powerquery-m/type-conversion#text" target="_blank"&gt;Type conversion - PowerQuery M | Microsoft Docs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 09:26:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Accessing-a-Record-from-API-Source/m-p/2571351#M36630</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-06-10T09:26:57Z</dc:date>
    </item>
  </channel>
</rss>

