<?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: Invoke-RestMethod : The remote server returned an error: (400) Bad Request. in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/447174#M13769</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22429"&gt;@mrslyfox&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since it works in Win 10, I would suggest:&lt;/P&gt;
&lt;P&gt;1. Follow&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/35986647/how-do-i-get-the-body-of-a-web-request-that-returned-400-bad-request-from-invoke" target="_self"&gt;how-do-i-get-the-body-of-a-web-request-that-returned-400-bad-request-from-invoke&lt;/A&gt;&amp;nbsp;to get more details of the error.&lt;/P&gt;
&lt;P&gt;2. Check your code with the information in the Service.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://ibb.co/ifScVT" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/4a5a578a47fa5f1d4bd0a0e479d74246653a7331/68747470733a2f2f696d6167652e6962622e636f2f6636374e78382f496e766f6b655f526573745f4d6574686f642e706e67" border="0" alt="Invoke_Rest_Method" /&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;3. A little possibility that caused by Firewall.&lt;/P&gt;
&lt;P&gt;4. Upgrade the Power Shell.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 08:16:42 GMT</pubDate>
    <dc:creator>v-jiascu-msft</dc:creator>
    <dc:date>2018-06-25T08:16:42Z</dc:date>
    <item>
      <title>Invoke-RestMethod : The remote server returned an error: (400) Bad Request.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/445288#M13726</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Windows 2012R2 x64&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PowerShell ISE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Script from PBI as is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;while($true){&lt;/P&gt;&lt;P&gt;$endpoint = "&lt;A href="https://api.powerbi.com/beta/xxxxxxxx" target="_blank"&gt;https://api.powerbi.com/beta/xxxxxxxx&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;$payload = @{&lt;/P&gt;&lt;P&gt;"Measured" =123&lt;BR /&gt;"DateTime" =Get-Date -Format F&lt;BR /&gt;"MachineName" ="Test"&lt;BR /&gt;"TargetValue" =1672&lt;BR /&gt;"MinValue" =0&lt;BR /&gt;"MaxValue" =6000&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Return folowing error:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Invoke-RestMethod : The remote server returned an error: (400) Bad Request.&lt;BR /&gt;At line:16 char:1&lt;BR /&gt;+ Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException&lt;BR /&gt;+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What needs to be fixed ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same script working fine at Windows 10 Pro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 14:18:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/445288#M13726</guid>
      <dc:creator>mrslyfox</dc:creator>
      <dc:date>2018-06-21T14:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The remote server returned an error: (400) Bad Request.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/447174#M13769</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22429"&gt;@mrslyfox&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since it works in Win 10, I would suggest:&lt;/P&gt;
&lt;P&gt;1. Follow&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/35986647/how-do-i-get-the-body-of-a-web-request-that-returned-400-bad-request-from-invoke" target="_self"&gt;how-do-i-get-the-body-of-a-web-request-that-returned-400-bad-request-from-invoke&lt;/A&gt;&amp;nbsp;to get more details of the error.&lt;/P&gt;
&lt;P&gt;2. Check your code with the information in the Service.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://ibb.co/ifScVT" target="_blank"&gt;&lt;IMG src="https://ip1.i.lithium.com/4a5a578a47fa5f1d4bd0a0e479d74246653a7331/68747470733a2f2f696d6167652e6962622e636f2f6636374e78382f496e766f6b655f526573745f4d6574686f642e706e67" border="0" alt="Invoke_Rest_Method" /&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;3. A little possibility that caused by Firewall.&lt;/P&gt;
&lt;P&gt;4. Upgrade the Power Shell.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 08:16:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/447174#M13769</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-06-25T08:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-RestMethod : The remote server returned an error: (400) Bad Request.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/452038#M13883</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/22429"&gt;@mrslyfox&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you solve it? Can you share the answer or mark the proper answer as a solution please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Dale&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jul 2018 14:50:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Invoke-RestMethod-The-remote-server-returned-an-error-400-Bad/m-p/452038#M13883</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-07-01T14:50:12Z</dc:date>
    </item>
  </channel>
</rss>

