<?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: JSON API Call Script Help in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3058783#M41018</link>
    <description>&lt;P&gt;Hello&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;Sorry for the delay. I have been away on parental leave and logged off completely from anything work related. Are you still in need of some information on the GetAccessToken() function? You can send me a direct message and I can try and provide some assistance.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 19:31:19 GMT</pubDate>
    <dc:creator>BH22One</dc:creator>
    <dc:date>2023-02-02T19:31:19Z</dc:date>
    <item>
      <title>JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2583982#M36770</link>
      <description>&lt;P&gt;Good Afternoon PBI Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am fairly new to JSON language as it pertains to APIs. Currently, I have an M script in Power Query that returns a binary list as seen below&lt;FONT size="2"&gt; (FYI I have a Bearer Token but have denoted it as "GetAccessToken()" below.)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to write the script in a way that returns a single value from one of the binary records. Not sure if this can be done but thought I'd throw it out there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source =Json.Document(Web.Contents("&lt;A href="https://US.api.blackline.com/api/queryruns" target="_blank" rel="noopener"&gt;https://US.api.blackline.com/api/queryruns&lt;/A&gt;", [Timeout=#duration(0, 0, 30, 0), Headers=[Authorization="Bearer "&amp;amp;&lt;STRONG&gt;&lt;EM&gt;GetAccessToken()&lt;/EM&gt;&lt;/STRONG&gt;, ContentType="application/json; charset=utf-8"]]))&lt;/P&gt;&lt;P&gt;in&lt;BR /&gt;#"Source"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BH22One_0-1655406669590.png" style="width: 127px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/733669i39137CE1697C6F47/image-dimensions/127x318?v=v2" width="127" height="318" role="button" title="BH22One_0-1655406669590.png" alt="BH22One_0-1655406669590.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, the "Record" in row 1 contains the information I need. This information being the most recent report posted to the site I am getting the data from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The information within the "Record" for Row 1 is as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BH22One_1-1655408577256.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/733684i82881F9CC2B702F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BH22One_1-1655408577256.png" alt="BH22One_1-1655408577256.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally I'd only like to return the "id" from this binary data "417197777".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;The data on the web site I'm pulling from updates every hour with a new unique "id" thus I am looking to use my json statement as a function (fx) in Power BI to return this value. I could use Power Query and convert this to a table and filter for the max date and then remove columns, however I am looking to satisfy this requirement solely through my JSON statement and convert it to a function if possible or any other method that doesn't require additional steps in Power Query Editor.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;I can provide additional detail as needed. Hoping someone has some guidance relative to this requirement.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Thanks!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 19:52:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2583982#M36770</guid>
      <dc:creator>BH22One</dc:creator>
      <dc:date>2022-06-16T19:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2586208#M36785</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/173593"&gt;@BH22One&lt;/a&gt;&amp;nbsp;- Power Query will help you open the JSON files, but first you need to convert the "List of Records" to a "Table of Records".&amp;nbsp; There should be a "Convert to Table" button to use in the CustomUI.&amp;nbsp; When you have the converted table, the column heading should have an "Expand to Columns" button.&amp;nbsp; This is when the Records that you are seeing will show in Rows &amp;amp; Columns.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 17:53:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2586208#M36785</guid>
      <dc:creator>Daryl-Lynch-Bzy</dc:creator>
      <dc:date>2022-06-17T17:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2586243#M36786</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/293962"&gt;@Daryl-Lynch-Bzy&lt;/a&gt;&amp;nbsp;Many thanks for the response. I have tried this approach previously and it does work beautiful in the desktop application. The problem is that Power BI Service doesn't support it when I publish the report to a Workspace. The reason being I am using the output from this step as a function that I input into a different API Call as a dynamic function. Dynamic funtions editted in with power Query aren't allowed to refresh on a Power BI Service Workspace (MAJOR miss by Microsoft in my opinion).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus why I am trying to do the steps you described within the JSON script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A similar situation would be if I had data in a SQL Database that I wanted to query, I could use a Where clause to single out the result I want. I'm not familar with JSON language and ideally would need that same approach if it's possible that is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;BH&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 18:21:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2586243#M36786</guid>
      <dc:creator>BH22One</dc:creator>
      <dc:date>2022-06-17T18:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2586265#M36789</link>
      <description>&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/powerquery-m/web-contents" target="_blank"&gt;Web.Contents - PowerQuery M | Microsoft Docs&lt;/A&gt;&amp;nbsp;- If you are having trouble with the Dynamic functions, it is likely that you have not used the "RelativePath" and "Query" features in Web.Contents.&amp;nbsp; This is important because the "URL" should be the "Base" URL in you case&amp;nbsp;&lt;A href="https://us.api.blackline.com/api/queryruns" target="_blank" rel="noopener nofollow noreferrer"&gt;"https://US.api.blackline.com&lt;/A&gt;".&amp;nbsp; Additionally, this must be defined once and referenced once.&amp;nbsp; I would include in the URL in Parameter.&amp;nbsp; The parameter should be included in the Web.Contents directly.&amp;nbsp; For example, when I create a function with two variables (URL and RelativePath) and then provide a column reference for these variables, I will run into the dynamic function error.&amp;nbsp; If I drop the URL variable, and just replace with the parameter reference, the dynamic function error goes away.&amp;nbsp; Power BI is now knows there can only be one URL for every call; while passing URL and Relative Path as variables to a function will confuse Power BI into thinking that the URL might be different.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 18:43:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2586265#M36789</guid>
      <dc:creator>Daryl-Lynch-Bzy</dc:creator>
      <dc:date>2022-06-17T18:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2590086#M36842</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/293962"&gt;@Daryl-Lynch-Bzy&lt;/a&gt;&amp;nbsp;thanks for the response. I slightly follow what your saying and have read/researched how "Relative Path" could be a used in my situation, however I am struggling to understand the syntax needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following statement...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;Source =&lt;BR /&gt;Csv.Document(&lt;BR /&gt;Web.Contents(&lt;BR /&gt;"&lt;A href="https://US.api.blackline.com/api/completedqueryrun/" target="_blank"&gt;https://US.api.blackline.com/api/completedqueryrun/&lt;/A&gt;",[RelativePath = GetReportId() &amp;amp;"/CSV"], [Timeout=#duration(0, 0, 30, 0), Headers=[Authorization="Bearer "&amp;amp;GetAccessToken(), ContentType="application/octet-stream"]]&lt;BR /&gt;),[Delimiter=",", Columns=13, Encoding=65001, QuoteStyle=QuoteStyle.None]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BH22One_0-1655740680746.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/735208iA4B44706C00460FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BH22One_0-1655740680746.png" alt="BH22One_0-1655740680746.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there something in my statement that's causing this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 16:02:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2590086#M36842</guid>
      <dc:creator>BH22One</dc:creator>
      <dc:date>2022-06-20T16:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2590146#M36844</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/173593"&gt;@BH22One&lt;/a&gt;&amp;nbsp;, does the following work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = 
    Csv.Document( 
        Web.Contents(
            "https://US.api.blackline.com/api/completedqueryrun/",
            [
                RelativePath = GetReportId() &amp;amp;"/CSV",
                Timeout=#duration(0, 0, 30, 0),
                Headers=[Authorization="Bearer "&amp;amp; GetAccessToken(), #"Content-Type"="application/octet-stream"]
            ]
    ), 
    [
        Delimiter=",",
        Columns=13, 
        Encoding=65001, 
        QuoteStyle=QuoteStyle.None
    ]
)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Jun 2022 17:00:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2590146#M36844</guid>
      <dc:creator>Daryl-Lynch-Bzy</dc:creator>
      <dc:date>2022-06-20T17:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2590446#M36850</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/293962"&gt;@Daryl-Lynch-Bzy&lt;/a&gt;&amp;nbsp;this worked beautifully. I was able to refresh, publish and set the refresh schedule for my report based on the requirements I had from the business.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jun 2022 20:23:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/2590446#M36850</guid>
      <dc:creator>BH22One</dc:creator>
      <dc:date>2022-06-20T20:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3000787#M40569</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/173593"&gt;@BH22One&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;Can you elaborate how your&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;GetAccessToken() &lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;function works?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I'm strugguling with authorization..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 11:44:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3000787#M40569</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-04T11:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3058783#M41018</link>
      <description>&lt;P&gt;Hello&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;Sorry for the delay. I have been away on parental leave and logged off completely from anything work related. Are you still in need of some information on the GetAccessToken() function? You can send me a direct message and I can try and provide some assistance.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 19:31:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3058783#M41018</guid>
      <dc:creator>BH22One</dc:creator>
      <dc:date>2023-02-02T19:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: JSON API Call Script Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3069405#M41118</link>
      <description>&lt;P&gt;Sure! No worries &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message should be in your mailbox. Will appreciate your guidance!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 15:06:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/JSON-API-Call-Script-Help/m-p/3069405#M41118</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-08T15:06:00Z</dc:date>
    </item>
  </channel>
</rss>

