<?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: Need some help calling API with body in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3207164#M42380</link>
    <description>&lt;P&gt;Any help is appreciated btw &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Apr 2023 12:27:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-04-26T12:27:47Z</dc:date>
    <item>
      <title>Need some help calling API with body</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3198157#M42314</link>
      <description>&lt;P&gt;so i have an API link to get data, it requires simply a post command with the api link and some body information&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the body info is as followed:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SteffH_0-1681998018153.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/904444iED9456C8667D0C87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SteffH_0-1681998018153.png" alt="SteffH_0-1681998018153.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine in Postman and I get the data in JSON format, but im curious how i can do the same in Power BI. Any help is appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also a second thing would be to make a script to receive the access token&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's a simple Post login link where the body is as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SteffH_1-1681998127903.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/904446i4F0AF7F3107510EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SteffH_1-1681998127903.png" alt="SteffH_1-1681998127903.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So the password and username and domain is given in the body, not in the authorization tab in Postman.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 13:43:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3198157#M42314</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-20T13:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need some help calling API with body</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3207164#M42380</link>
      <description>&lt;P&gt;Any help is appreciated btw &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 12:27:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3207164#M42380</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-26T12:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Need some help calling API with body</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3217278#M42500</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, I will use&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/get-dataset-in-group" target="_self"&gt;Datasets - Get Dataset In Group&lt;/A&gt;&amp;nbsp; API as an example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
//Get API Token
  tokenapiUrl = "https://login.microsoftonline.com/ecxxxxxxxx/oauth2/v2.0/token",
    body = [
          client_id="d32xxxxxx",
          grant_type="client_credentials",
          client_secret="vMfxxxxxx",
          scope="https://analysis.windows.net/powerbi/api/.default"
],

API_Response = Json.Document(Web.Contents(tokenapiUrl, [Headers = [Accept = "application/json"],
Content = Text.ToBinary(Uri.BuildQueryString(body))])),
token = API_Response[access_token],
//Get Data
apiUrl = "https://api.powerbi.com/v1.0/myorg/groups/476xxxxxxx/datasets/3a7xxxxxx",
data  = Json.Document(Web.Contents(apiUrl,[Headers=[#"Authorization"="Bearer "&amp;amp;token,#"Content-Type"="application/json"]]))
in
data&lt;/LI-CODE&gt;
&lt;P&gt;Final output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_0-1683099657613.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/909710i35FCA8E9F901994B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_0-1683099657613.png" alt="vjianbolimsft_0-1683099657613.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 07:41:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3217278#M42500</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2023-05-03T07:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need some help calling API with body</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3219412#M42519</link>
      <description>&lt;P&gt;Hi Jianboli,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all thanks for the detailed answer, however i think I'm running into one problem, the following things are given in the body of the getData call (not in the headers):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- access_token=&lt;/P&gt;&lt;P&gt;- version= (9.5 for example)&lt;/P&gt;&lt;P&gt;- images= (0 for example)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm dealing with a POST request, not a get request, and these parameters will not work when given as a header, but only when given in the body.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 07:42:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3219412#M42519</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-04T07:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need some help calling API with body</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3219457#M42520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;While the Power Query Web.Contents() function generates a GET request by default, you can make it generate a POST request by specifying the Content option.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjianbolimsft_0-1683187701674.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/910278i686DDF29DFA516D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjianbolimsft_0-1683187701674.png" alt="vjianbolimsft_0-1683187701674.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more details, please refer to:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powerquery-m/web-contents" target="_blank"&gt;Web.Contents - PowerQuery M | Microsoft Learn&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blog.crossjoin.co.uk/2014/04/19/web-services-and-post-requests-in-power-query/" target="_blank"&gt;Chris Webb&amp;amp;#039;s BI Blog: Web Services And POST Requests In Power Query&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jianbo Li&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 08:09:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Need-some-help-calling-API-with-body/m-p/3219457#M42520</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2023-05-04T08:09:53Z</dc:date>
    </item>
  </channel>
</rss>

