<?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 Windows PowerShell ISE Invoke-RestMethod 404 error in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Windows-PowerShell-ISE-Invoke-RestMethod-404-error/m-p/3459221#M44802</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Anyone see what is wrong with the below in Windows PowerShell ISE?&lt;/P&gt;&lt;P&gt;It works with -Method Post but not Put. Testing overwriting the data every 12 seconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;while (1 -eq 1 ){
$command=

$data = Invoke-RestMethod -Method Get "https://api.xxxxxxxxxx"
$endpoint = "https://api.powerbi.com/beta/xxxxxxxxxxxxxxx/datasets/xxxxxxxxxxx/rows?experience=power-bi&amp;amp;key=xxxxxxxxxxxxxxxxx"
$payload = @{
"ticker" =$data."ticker"
"v" =$data."results"."v"
"vw" =$data."results"."vw"
"o" =$data."results"."o"
"c" =$data."results"."c"
"h" =$data."results"."h"
"l" =$data."results"."l"
"t" =$data."results"."t"
"n" =$data."results"."n"
}
Invoke-RestMethod -Method Put -Uri "$endpoint" -Body (ConvertTo-Json @($payload))

$command
start-sleep -seconds 12
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Returns:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At C:\Users\xxxxx\OneDrive - xxxxx\Desktop\API stock test.ps1:17 char:1
+ Invoke-RestMethod -Method Put -Uri "$endpoint" -Body (ConvertTo-Json ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2023 10:12:24 GMT</pubDate>
    <dc:creator>Nyx</dc:creator>
    <dc:date>2023-10-04T10:12:24Z</dc:date>
    <item>
      <title>Windows PowerShell ISE Invoke-RestMethod 404 error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Windows-PowerShell-ISE-Invoke-RestMethod-404-error/m-p/3459221#M44802</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Anyone see what is wrong with the below in Windows PowerShell ISE?&lt;/P&gt;&lt;P&gt;It works with -Method Post but not Put. Testing overwriting the data every 12 seconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;while (1 -eq 1 ){
$command=

$data = Invoke-RestMethod -Method Get "https://api.xxxxxxxxxx"
$endpoint = "https://api.powerbi.com/beta/xxxxxxxxxxxxxxx/datasets/xxxxxxxxxxx/rows?experience=power-bi&amp;amp;key=xxxxxxxxxxxxxxxxx"
$payload = @{
"ticker" =$data."ticker"
"v" =$data."results"."v"
"vw" =$data."results"."vw"
"o" =$data."results"."o"
"c" =$data."results"."c"
"h" =$data."results"."h"
"l" =$data."results"."l"
"t" =$data."results"."t"
"n" =$data."results"."n"
}
Invoke-RestMethod -Method Put -Uri "$endpoint" -Body (ConvertTo-Json @($payload))

$command
start-sleep -seconds 12
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Returns:&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At C:\Users\xxxxx\OneDrive - xxxxx\Desktop\API stock test.ps1:17 char:1
+ Invoke-RestMethod -Method Put -Uri "$endpoint" -Body (ConvertTo-Json ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 10:12:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Windows-PowerShell-ISE-Invoke-RestMethod-404-error/m-p/3459221#M44802</guid>
      <dc:creator>Nyx</dc:creator>
      <dc:date>2023-10-04T10:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Windows PowerShell ISE Invoke-RestMethod 404 error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Windows-PowerShell-ISE-Invoke-RestMethod-404-error/m-p/3467660#M44850</link>
      <description>&lt;P&gt;That's working as designed.&amp;nbsp; Were you expecting a different behavior?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW you are missing the table name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/push-datasets/datasets-post-rows" target="_blank"&gt;Push Datasets - Datasets PostRows - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2023 23:30:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Windows-PowerShell-ISE-Invoke-RestMethod-404-error/m-p/3467660#M44850</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-10-09T23:30:01Z</dc:date>
    </item>
  </channel>
</rss>

