<?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: Automatic report upload through API erratic behaviour - looking for guidelines in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1707769#M28232</link>
    <description>&lt;P&gt;How do you set parameters and retrieve data?&lt;/P&gt;&lt;P&gt;Could you provide more information to let me know your scenario&lt;/P&gt;</description>
    <pubDate>Mon, 08 Mar 2021 02:18:16 GMT</pubDate>
    <dc:creator>V-lianl-msft</dc:creator>
    <dc:date>2021-03-08T02:18:16Z</dc:date>
    <item>
      <title>Automatic report upload through API erratic behaviour - looking for guidelines</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1702564#M28196</link>
      <description>&lt;P&gt;I have been working professionally with measurement data vissulatisation in PBI for over a year, and one of my job tasks is to manage an ever-growing number of reports for our company. For this reason we have moved from manually managing reports through the PBI service GUI to automatic management via a number of PowerShell scripts. This includes automatic upload of tens of reports at a time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In pseudocode, this&amp;nbsp; is what the script attempts to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for each customer account in our DB:&lt;/P&gt;&lt;P&gt;Check if report exists&lt;/P&gt;&lt;P&gt;If not:&lt;/P&gt;&lt;P&gt;upload empty report template&lt;/P&gt;&lt;P&gt;Set parameters that pair report with customer account&lt;/P&gt;&lt;P&gt;Set refresh schedule&lt;/P&gt;&lt;P&gt;Refresh dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, PBI service responds in an erratic and unpredictable way when attempting automatic report upload. It appears that often the parameters does not get set, making the report unable to retrieve customer data. I have added a 10 sec wait command between every requests to give the PBI service API and DB some breathing space, but this doesn't seem to improve behaviour.&lt;BR /&gt;&lt;BR /&gt;I am looking for guidelines on how to manage multiple report upload through API calls without running into these challenges.&lt;BR /&gt;&lt;BR /&gt;Cheers, Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 07:37:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1702564#M28196</guid>
      <dc:creator>h4tt3n</dc:creator>
      <dc:date>2021-03-04T07:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic report upload through API erratic behaviour - looking for guidelines</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1707769#M28232</link>
      <description>&lt;P&gt;How do you set parameters and retrieve data?&lt;/P&gt;&lt;P&gt;Could you provide more information to let me know your scenario&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 02:18:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1707769#M28232</guid>
      <dc:creator>V-lianl-msft</dc:creator>
      <dc:date>2021-03-08T02:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Automatic report upload through API erratic behaviour - looking for guidelines</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1708123#M28241</link>
      <description>&lt;P&gt;I retrieve data from Azure T-SQL DB using a SQL query. I set parameters with an API call, using the below function. It works most of the time, but fails sometimes for non-apparetn reasons. I have improved the success-rate by increasing the wait time after the report is uploaded, before updating parameters.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Also, I have noticed a peculiar tencency; older accounts (4-5 years) tend to fail more often than accounts that have recently been created ( &amp;lt; one year).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function UpdateParameter
{
    # This operation is only supported for the dataset owner. Call TakeOverDataset()
    
    [CmdLetBinding()]
    param 
    ( 
        [Parameter(Mandatory=$true, Position=0)] [string] $datasetId, 
        [Parameter(Mandatory=$true, Position=1)] [string] $parameterName, 
        [Parameter(Mandatory=$true, Position=2)] [string] $parameterNewValue 
    )
    
    $url = "https://api.powerbi.com/v1.0/myorg/datasets/$datasetId/Default.UpdateParameters"

    $body = '{ "updateDetails": [ { "name": "'+$parameterName+'", "newValue": "'+$parameterNewValue+'" } ] }'

    Invoke-PowerBIRestMethod -Url $url -Body $body -Method POST

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers, Mike&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 06:58:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Automatic-report-upload-through-API-erratic-behaviour-looking/m-p/1708123#M28241</guid>
      <dc:creator>h4tt3n</dc:creator>
      <dc:date>2021-03-08T06:58:37Z</dc:date>
    </item>
  </channel>
</rss>

