<?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: Wait for Power BI dataset to refresh using the API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2292105#M33968</link>
    <description>&lt;P&gt;You were correct in the end, thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed to get the status from the $history.status within the while loop, I was getting this from the status variable outside of the while loop so this was never changing. After setting the while loop condition status to the while loop status the correct status value was returning to exit the while loop...phew!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jan 2022 22:06:41 GMT</pubDate>
    <dc:creator>powerbi_jenhen</dc:creator>
    <dc:date>2022-01-19T22:06:41Z</dc:date>
    <item>
      <title>Wait for Power BI dataset to refresh using the API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2287419#M33916</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Via Powershell I'm able to invoke the Power BI API to start a dataset refresh using the "refresh dataset in group" API but using a while loop like below on the status value doesn't appear to exit the loop when the refresh completes to a status "Completed"? How can I write logic to wait for the dataset refresh to complete as once completed I need to set a variable value to output for another process to trigger:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;while&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$status&lt;/SPAN&gt; &lt;SPAN&gt;-eq&lt;/SPAN&gt; &lt;SPAN&gt;"Unknown"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Start-Sleep&lt;/SPAN&gt; &lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;s &lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$history&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;Invoke-PowerBIRestMethod&lt;/SPAN&gt; &lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;Url &lt;/SPAN&gt;&lt;SPAN&gt;$url&lt;/SPAN&gt; &lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;Method Get &lt;/SPAN&gt;&lt;SPAN&gt;|&lt;/SPAN&gt; &lt;SPAN&gt;ConvertFrom-Json&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#this loop never exits even although the dataset refresh completes with status "Completed"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 Jan 2022 20:17:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2287419#M33916</guid>
      <dc:creator>powerbi_jenhen</dc:creator>
      <dc:date>2022-01-17T20:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Wait for Power BI dataset to refresh using the API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2289694#M33939</link>
      <description>&lt;P&gt;You forgot to set the value of $status inside the loop.&lt;/P&gt;
&lt;P&gt;Don't ask for it every five seconds. Every minute is enough.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jan 2022 21:03:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2289694#M33939</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2022-01-18T21:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Wait for Power BI dataset to refresh using the API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2289918#M33942</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of status will be set by the Power BI Service, I'm using the Start-Sleep to wait for status to change to "Completed" when the refresh completes. However, once I see the refresh has completed the new status isn't reflected to exit the loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 00:02:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2289918#M33942</guid>
      <dc:creator>powerbi_jenhen</dc:creator>
      <dc:date>2022-01-19T00:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Wait for Power BI dataset to refresh using the API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2292105#M33968</link>
      <description>&lt;P&gt;You were correct in the end, thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I needed to get the status from the $history.status within the while loop, I was getting this from the status variable outside of the while loop so this was never changing. After setting the while loop condition status to the while loop status the correct status value was returning to exit the while loop...phew!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 22:06:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/2292105#M33968</guid>
      <dc:creator>powerbi_jenhen</dc:creator>
      <dc:date>2022-01-19T22:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Wait for Power BI dataset to refresh using the API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/3108814#M41505</link>
      <description>&lt;P&gt;Thank you. Your posts and solution were most helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 20:59:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Wait-for-Power-BI-dataset-to-refresh-using-the-API/m-p/3108814#M41505</guid>
      <dc:creator>Delbert</dc:creator>
      <dc:date>2023-03-02T20:59:26Z</dc:date>
    </item>
  </channel>
</rss>

