<?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: Rest API Authentication API-Key in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1318738#M25417</link>
    <description>&lt;P&gt;Hi Ibendlin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you mean that I have to put my apikey into the Json.FromValue function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let&lt;BR /&gt;URL = "URL",&lt;BR /&gt;headers = [#"Content-Type"="application/json"],&lt;BR /&gt;data = Json.FromValue([apiKey = 123ABC]),&lt;BR /&gt;web = Web.Contents(URL,[ Content = data,Headers = headers, ManualStatusHandling = {404, 400}]),&lt;BR /&gt;result = Json.Document(web)&lt;BR /&gt;in&lt;BR /&gt;result&lt;/PRE&gt;&lt;P&gt;It gives ma an error, my api key is mixture of letters and numbers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my API documentation says:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTTP Method&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;POST&lt;/P&gt;&lt;P&gt;Query&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;A json object contaaining only the "apiKey" field inside.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;body: {&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;apiKey: "xxxxx"&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 24 Aug 2020 08:46:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-08-24T08:46:46Z</dc:date>
    <item>
      <title>Rest API Authentication API-Key</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1314965#M25383</link>
      <description>&lt;P&gt;Hey guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I'm new into power bi and the power query m language and never worked with that.&lt;/P&gt;&lt;P&gt;Basically I'm trying to connect a rest api with my power bi.&lt;/P&gt;&lt;P&gt;In order to get the data, I'll have to perform a POST call with a api key to obtain a beaerer token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My approach was to use the advanced editor with the web.contents function. But I always get the error "(404) Not found"&lt;/P&gt;&lt;P&gt;Could u guys take a look at my function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;/P&gt;&lt;P&gt;GetJson = Web.Contents("URL", [Headers=[#"Content-Type"="application/json", #"X-API-Key"="ABC"]])&lt;BR /&gt;in&lt;/P&gt;&lt;P&gt;GetJson&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ps: the endpoint works fine, I tried it on postman and got the bearer token.&lt;/P&gt;&lt;P&gt;I just cant obtain it on power bi.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2020 14:09:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1314965#M25383</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-21T14:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API Authentication API-Key</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1315359#M25390</link>
      <description>&lt;P&gt;If the API requires a POST call then you need to put the data in the body, not the header.&amp;nbsp; Consult the API documentation, and then use Json.FromValue() to binary encode the payload.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like so:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;let
    URL = "http://xxx/tstat",
    headers = [#"Content-Type"="application/json"],
    data = Json.FromValue([tmode = 2,t_cool = Setpoint,hold = 0]),
    web = Web.Contents(URL, [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
    result = Json.Document(web),
...&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 21 Aug 2020 16:32:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1315359#M25390</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-08-21T16:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API Authentication API-Key</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1318738#M25417</link>
      <description>&lt;P&gt;Hi Ibendlin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you mean that I have to put my apikey into the Json.FromValue function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let&lt;BR /&gt;URL = "URL",&lt;BR /&gt;headers = [#"Content-Type"="application/json"],&lt;BR /&gt;data = Json.FromValue([apiKey = 123ABC]),&lt;BR /&gt;web = Web.Contents(URL,[ Content = data,Headers = headers, ManualStatusHandling = {404, 400}]),&lt;BR /&gt;result = Json.Document(web)&lt;BR /&gt;in&lt;BR /&gt;result&lt;/PRE&gt;&lt;P&gt;It gives ma an error, my api key is mixture of letters and numbers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my API documentation says:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTTP Method&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;POST&lt;/P&gt;&lt;P&gt;Query&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;A json object contaaining only the "apiKey" field inside.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;body: {&lt;/P&gt;&lt;P class="lia-indent-padding-left-90px"&gt;apiKey: "xxxxx"&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 08:46:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1318738#M25417</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-24T08:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API Authentication API-Key</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1319563#M25421</link>
      <description>&lt;P&gt;you are missing the quotes around the key&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data = Json.FromValue([apiKey = "123ABC"]),&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Aug 2020 13:40:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-Authentication-API-Key/m-p/1319563#M25421</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-08-24T13:40:21Z</dc:date>
    </item>
  </channel>
</rss>

