<?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: Admin - Datasets GetDatasetToDataflowsLinksInGroupAsAdmin - Avoiding Hitting API Call Limit in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1661825#M27810</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/707"&gt;@TravisKale&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your sharing and you could&amp;nbsp;&lt;A href="https://ideas.powerbi.com/ideas/" target="_self"&gt;submit your idea&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Lionel Chen&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Feb 2021 02:48:14 GMT</pubDate>
    <dc:creator>v-lionel-msft</dc:creator>
    <dc:date>2021-02-12T02:48:14Z</dc:date>
    <item>
      <title>Admin - Datasets GetDatasetToDataflowsLinksInGroupAsAdmin - Avoiding Hitting API Call Limit</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1655696#M27759</link>
      <description>&lt;P&gt;I am using the &lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/admin/datasets_getdatasettodataflowslinksingroupasadmin#code-try-0" target="_self"&gt;Admin - Datasets GetDatasetToDataflowsLinksInGroupAsAdmin&lt;/A&gt; API to get the dataflows used by datasets.&amp;nbsp;&amp;nbsp; The problem I am running into is the only way to get this data is by workspace.&amp;nbsp;&amp;nbsp; I have over 3K workspaces, the API only allows 200 calls per hour for this endpoint.&amp;nbsp;&amp;nbsp; Is the API really this short sighted to not allow a broader scope to get this data?&amp;nbsp;&amp;nbsp; With this limitation it would take over 15 hours total time to get all the data I need. Not only will it take more time, it will require more complicated code to handle the stopping and resuming after the call limit has been exhausted. &amp;nbsp;&amp;nbsp;&amp;nbsp; I would think this endpoint should be setup more like &lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/admin/datasets_getdatasourcesasadmin" target="_self"&gt;Admin - Datasets GetDatasourcesAsAdmin&lt;/A&gt;&amp;nbsp; where there is no limit to calls per hour but rather the API processes each request for 0.5 seconds, in the mean time other requests will be queued.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming I am out of luck until Microsoft realizes the&amp;nbsp;shortsightedness of this limitation but just in case.... anyone know of a way&amp;nbsp;around this issue?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 23:24:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1655696#M27759</guid>
      <dc:creator>TravisKale</dc:creator>
      <dc:date>2021-02-09T23:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Admin - Datasets GetDatasetToDataflowsLinksInGroupAsAdmin - Avoiding Hitting API Call Limit</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1657863#M27769</link>
      <description>&lt;P&gt;I have figured out a hack around this issue.&amp;nbsp; I call it a hack&amp;nbsp;because it will only work if you happen to have less than 200 workspaces with datasets that use a dataflow as a datasource, if you have more than 200 workspaces in this criteria there is still an issue with the API call limit.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The powershell code below demonstrates the workaround.&amp;nbsp;&amp;nbsp; You need to check the connection details of a datasource.&amp;nbsp; If the datasourceType is equal to "Extension" and the connectionDetails contains "path": "PowerBI" then the dataset uses a dataflow as a source, if so I add the workspace the dataset lives into an array.&amp;nbsp;&amp;nbsp; I then loop through that array looking for DatasetToDataflowLinks instead of all workspaces in my environment.&amp;nbsp;&amp;nbsp; This script takes quite a while to run from the numerous calls to the API since there is no way to eager load all DatasetDatasources in one call either just like the DStoDFLinks.&amp;nbsp; I don't check the full&amp;nbsp;connection details, if you want to, the JSON looks like this for datasources that are dataflows: { "path": "PowerBI", "kind": "PowerBI" }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;$datasetDatasources = @()
$WorkspaceIdsWithDatasetsThatUseDataflows = @()
$workspaceDatasets = @()

Login-PowerBI

$workSpaces = Get-PowerBIWorkspace -Scope Organization -Include Datasets -All # -Filter "isOnDedicatedCapacity eq true"
$workSpaces | Add-Member -MemberType AliasProperty -Name WorkspaceId -Value id 


ForEach($workSpace in $workSpaces)
{
    ForEach($dataSet in $workspace.datasets)
    {
        $dataSet | Add-Member -NotePropertyName WorkspaceId -NotePropertyValue $workSpace.id
        $dataSet | Add-Member -MemberType AliasProperty -Name DatasetId -Value id 
        $workspaceDatasets+=$dataSet
    }
}

ForEach($dataSet in $workspaceDatasets)
{
    $datasourceApiUrl = "https://api.powerbi.com/v1.0/myorg/admin/datasets/" + $dataset.id + "/datasources"
    $apiDatasourceResult = Invoke-PowerBIRestMethod -Url $datasourceApiUrl -Method Get | ConvertFrom-Json
    $datasources = $apiDatasourceResult.value

    $datasources | Add-Member -NotePropertyName DatasetId -NotePropertyValue $dataset.Id
    $datasources | Add-Member -NotePropertyName WorkspaceId -NotePropertyValue $dataset.WorkspaceId
    $datasources | Add-Member -NotePropertyName ConnectionDetailsJson -NotePropertyValue "" 

    ForEach($dataItem in $datasources)
    {
        $dataItem.ConnectionDetailsJson = ConvertTo-Json $dataItem.connectionDetails 

        If ($dataItem.datasourceType -eq "Extension" -and $dataItem.ConnectionDetailsJson -like '*"path":  "PowerBI"*' -and $WorkspaceIdsWithDatasetsThatUseDataflows -notcontains $dataset.WorkspaceId)
        {
            $WorkspaceIdsWithDatasetsThatUseDataflows += $dataset.WorkspaceId
        }
    }

    $datasetDatasources += $datasources
}

if($WorkspaceIdsWithDatasetsThatUseDataflows.Count &amp;gt; 200)
{
    throw "Too many Workspaces with Datasets Using Dataflows to Fit in to this hack around the API call limit of 200"
}

ForEach($ws in $WorkspaceIdsWithDatasetsThatUseDataflows)
{               
    $ApiUrl = "https://api.powerbi.com/v1.0/myorg/admin/groups/" + $ws + "/datasets/upstreamDataflows"
    $apiDfLinksResult = Invoke-PowerBIRestMethod -Url $ApiUrl -Method Get 

    $apiDfLinksObjectResult =   $apiDfLinksResult | ConvertFrom-Json 

    $upStreamFlows = $apiDfLinksObjectResult.value

    ForEach($up in $upStreamFlows)
    {
        $up | Add-Member -NotePropertyName DatasetWorkspaceId -NotePropertyValue $ws
        $up | Add-Member -MemberType AliasProperty -Name DatasetId -Value datasetObjectId
        $up | Add-Member -MemberType AliasProperty -Name DataflowId -Value dataflowObjectId
        $up | Add-Member -MemberType AliasProperty -Name DataflowWorkspaceId -Value workspaceObjectId

        $workspaceDatasetToDataflowLinks += $up
    }
        
}

$workspaceDatasetToDataflowLinks | Export-CSV -NoTypeInformation -Force -Path .\DatasetToDataflowLinks.csv
$workSpaces | Export-CSV -NoTypeInformation -Force -Path .\Workspaces.csv
$workspaceDatasets | Export-CSV -NoTypeInformation -Force -Path .\Datasets.csv
$datasetDatasources | Export-CSV -NoTypeInformation -Force -Path .\DatasetDatasources.csv&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Feb 2021 14:06:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1657863#M27769</guid>
      <dc:creator>TravisKale</dc:creator>
      <dc:date>2021-02-10T14:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Admin - Datasets GetDatasetToDataflowsLinksInGroupAsAdmin - Avoiding Hitting API Call Limit</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1661825#M27810</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/707"&gt;@TravisKale&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your sharing and you could&amp;nbsp;&lt;A href="https://ideas.powerbi.com/ideas/" target="_self"&gt;submit your idea&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Lionel Chen&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 02:48:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Admin-Datasets-GetDatasetToDataflowsLinksInGroupAsAdmin-Avoiding/m-p/1661825#M27810</guid>
      <dc:creator>v-lionel-msft</dc:creator>
      <dc:date>2021-02-12T02:48:14Z</dc:date>
    </item>
  </channel>
</rss>

