├── .DS_Store ├── .gitattributes ├── .gitignore ├── LICENSE ├── Power BI API.mez ├── Power BI API └── PowerBIRESTAPI │ ├── .gitignore │ ├── .vscode │ ├── settings.json │ └── tasks.json │ ├── PBIAPI.pq │ ├── PBIAPI.query.pq │ ├── PBIAPI16.png │ ├── PBIAPI20.png │ ├── PBIAPI24.png │ ├── PBIAPI32.png │ ├── PBIAPI40.png │ ├── PBIAPI48.png │ ├── PBIAPI64.png │ ├── PBIAPI80.png │ ├── resources.es.resx │ └── resources.resx ├── Power BI REST API.png └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/.DS_Store -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Miguel Escobar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Power BI API.mez: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API.mez -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/.gitignore: -------------------------------------------------------------------------------- 1 | AppID.txt 2 | ClientSecret.txt -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "powerquery.sdk.defaultExtension": "${workspaceFolder}\\bin\\AnyCPU\\Debug\\${workspaceFolderBasename}.mez", 3 | "powerquery.sdk.defaultQueryFile": "${workspaceFolder}\\PBIAPI.query.pq" 4 | } -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "type": "powerquery", 6 | "operation": "compile", 7 | "additionalArgs": [], 8 | "group": { 9 | "kind": "build", 10 | "isDefault": true 11 | }, 12 | "problemMatcher": [], 13 | "label": "build: Build connector project using MakePQX" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI.pq: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////// 2 | /////////////////////////////////////////////////////////////////////////////////////////// 3 | ///////////// ///////////// 4 | ///////////// Title: Power BI REST API Connector for Power BI ///////////// 5 | ///////////// Created by: Miguel Escobar (@EscobarMiguel90) ///////////// 6 | ///////////// Website: https://github.com/migueesc123/powerbiRESTAPI ///////////// 7 | ///////////// ///////////// 8 | /////////////////////////////////////////////////////////////////////////////////////////// 9 | /////////////////////////////////////////////////////////////////////////////////////////// 10 | 11 | section PowerBIRESTAPI; 12 | 13 | // 14 | // OAuth configuration settings 15 | // 16 | 17 | client_id = Text.FromBinary(Extension.Contents("AppID.txt")); 18 | 19 | client_secret = Text.FromBinary(Extension.Contents("ClientSecret.txt")); 20 | 21 | redirect_uri = "https://oauth.powerbi.com/views/oauthredirect.html"; 22 | token_uri = "https://login.windows.net/common/oauth2/token"; 23 | authorize_uri = "https://login.windows.net/common/oauth2/authorize"; 24 | logout_uri = "https://login.microsoftonline.com/logout.srf"; 25 | resourceUri = "https://analysis.windows.net/powerbi/api"; 26 | 27 | windowWidth = 720; 28 | windowHeight = 1024; 29 | 30 | [DataSource.Kind="PowerBIRESTAPI", Publish="PowerBIRESTAPI.UI"] 31 | shared PowerBIRESTAPI.Navigation = () as table => 32 | let 33 | objects = #table( 34 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 35 | {Extension.LoadString("MyWorkspace"),"MyWorkspace",MyWorkspaceNavTable(),"Folder","MyWorkspace",false}, 36 | {Extension.LoadString("AppWorkspace"),"AppWorkspace",AppWorkspacesNavTable(),"Folder","AppWorkspace",false}, 37 | {Extension.LoadString("Gateways"),"Gateways",GatewaysNavTable(),"Folder","Gateways",false}, 38 | {Extension.LoadString("Admin"),"Admin",AdminNavTable(),"Folder","Admin",false}, 39 | {Extension.LoadString("Experimental"),"Experimental",ExperimentalNavTable(),"Folder","Experimental",false}, 40 | {"Functions","Functions",FunctionsNavTable(),"Folder","Functions",false} 41 | }), 42 | NavTable = Table.ToNavigationTable(objects,{"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 43 | in 44 | NavTable; 45 | 46 | GatewaysNavTable = () as table => 47 | let 48 | objects = #table( 49 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 50 | {Extension.LoadString("Gateways"),"Gateways",PowerBIRESTAPI.Gateways(),"Table","Table",true}, 51 | {Extension.LoadString("GatewayDataSources"),"GatewayDataSources",PowerBIRESTAPI.GatewayDataSources(),"Table","Table",true}, 52 | {Extension.LoadString("GatewayDataSourceUsers"),"GatewayDataSourceUsers",PowerBIRESTAPI.GatewayDataSourceUsers(),"Table","Table",true} 53 | }), 54 | NavTable = Table.ToNavigationTable(objects,{"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 55 | in 56 | NavTable; 57 | 58 | MyWorkspaceNavTable = () as table => 59 | let 60 | objects = #table( 61 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 62 | {Extension.LoadString("PersonalDashboards"),"PersonalDashboards",PowerBIRESTAPI.MWDashboards(),"Table","Table",true}, 63 | {Extension.LoadString("PersonalReports"),"PersonalReports",PowerBIRESTAPI.MWReports(),"Table","Table",true}, 64 | {Extension.LoadString("PersonalDatasets"),"PersonalDatasets",PowerBIRESTAPI.MWDatasets(),"Table","Table",true}, 65 | {Extension.LoadString("PersonalApps"),"PersonalApps",PowerBIRESTAPI.MWApps(),"Table","Table",true}, 66 | {Extension.LoadString("PersonalRefreshHistory"),"PersonalRefreshHistory",PowerBIRESTAPI.MWRefreshHistory(),"Table","Table",true} 67 | }), 68 | NavTable = Table.ToNavigationTable(objects,{"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 69 | in 70 | NavTable; 71 | 72 | 73 | AppWorkspacesNavTable = () as table => 74 | let 75 | objects = #table( 76 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 77 | {Extension.LoadString("Workspaces"),"Workspaces",PowerBIRESTAPI.GroupsList(),"Table","Table",true}, 78 | {Extension.LoadString("Workspace Users"),"Workspace Users",PowerBIRESTAPI.GroupsUsers(),"Table","Table",true}, 79 | {Extension.LoadString("Dashboards"),"Dashboards",PowerBIRESTAPI.GroupsDashboards(),"Table","Table",true}, 80 | {Extension.LoadString("DashboardTiles"),"DashboardTiles",PowerBIRESTAPI.GroupsDashboardTiles(),"Table","Table",true}, 81 | {Extension.LoadString("Reports"),"Reports",PowerBIRESTAPI.GroupsReports(),"Table","Table",true}, 82 | {Extension.LoadString("ReportPages"),"ReportPages",PowerBIRESTAPI.ReportPages(),"Table","Table",true}, 83 | {Extension.LoadString("Datasets"),"Datasets",PowerBIRESTAPI.GroupsDatasets(),"Table","Table",true}, 84 | {Extension.LoadString("Datasources"),"Datasources",PowerBIRESTAPI.GroupsDatasources(),"Table","Table",true}, 85 | {Extension.LoadString("Dataflows"),"Dataflows",PowerBIRESTAPI.GroupsDataflows(),"Table","Table",true}, 86 | {Extension.LoadString("Pipelines"),"Pipelines",PowerBIRESTAPI.GroupsPipelines(),"Table","Table",true}, 87 | {Extension.LoadString("PipelineStages"),"PipelineStages",PowerBIRESTAPI.GroupsPipelineStages(),"Table","Table",true}, 88 | {Extension.LoadString("PipelineUsers"),"PipelineUsers",PowerBIRESTAPI.GroupsPipelineUsers(),"Table","Table",true}, 89 | {Extension.LoadString("PipelineOperations"),"PipelineOperations",PowerBIRESTAPI.GroupsPipelineOperations(),"Table","Table",true}, 90 | {Extension.LoadString("PipelineStageArtifacts"),"PipelineStageArtifacts",PowerBIRESTAPI.GroupsPipelineStageArtifacts(),"Table","Table",true}, 91 | {Extension.LoadString("DataflowsTransactions"),"DataflowsTransactions",PowerBIRESTAPI.AWDataflowsTransactions(),"Table","Table",true}, 92 | {Extension.LoadString("DataflowDatasources"),"DataflowDatasources",PowerBIRESTAPI.GroupsDataflowDataSources(),"Table","Table",true}, 93 | {Extension.LoadString("DataflowUpstreamDataflows"),"DataflowUpstreamDataflows",PowerBIRESTAPI.GroupsDataflowUpstreamDataflows(),"Table","Table",true}, 94 | {Extension.LoadString("DatasetToDataflowLinks"),"DatasetToDataflowLinks",PowerBIRESTAPI.GroupsDatasetToDataflowsLinks(),"Table","Table",true}, 95 | {Extension.LoadString("RefreshHistory"),"RefreshHistory",PowerBIRESTAPI.AWRefreshHistory(),"Table","Table",true}, 96 | {Extension.LoadString("RefreshSchedule"),"RefreshSchedule",PowerBIRESTAPI.AWRefreshSchedule(),"Table","Table",true} 97 | }), 98 | NavTable = Table.ToNavigationTable(objects,{"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 99 | in 100 | NavTable; 101 | 102 | AdminNavTable = () as table => 103 | let 104 | objects = #table( 105 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 106 | {Extension.LoadString("AppsAsAdmin"),"AppsAsAdmin",PowerBIRESTAPI.AppsAsAdmin(),"Table","Table",true}, 107 | {Extension.LoadString("AppUsersAsAdmin"),"AppUsersAsAdmin",PowerBIRESTAPI.AppUsersAsAdmin(),"Table","Table",true}, 108 | {Extension.LoadString("GroupsAsAdmin"),"GroupsAsAdmin",PowerBIRESTAPI.GroupsAsAdmin(),"Table","Table",true}, 109 | {Extension.LoadString("GroupUsersAsAdmin"),"GroupUsersAsAdmin",PowerBIRESTAPI.GroupUsersAsAdmin(),"Table","Table",true}, 110 | {Extension.LoadString("ReportsAsAdmin"),"ReportsAsAdmin",PowerBIRESTAPI.ReportsAsAdmin(),"Table","Table",true}, 111 | {Extension.LoadString("DashboardsAsAdmin"),"DashboardsAsAdmin",PowerBIRESTAPI.DashboardsAsAdmin(),"Table","Table",true}, 112 | {Extension.LoadString("DataflowsAsAdmin"),"DataflowsAsAdmin",PowerBIRESTAPI.DataflowsAsAdmin(),"Table","Table",true}, 113 | {Extension.LoadString("DatasetsAsAdmin"),"DatasetsAsAdmin",PowerBIRESTAPI.DatasetsAsAdmin(),"Table","Table",true}, 114 | {Extension.LoadString("PipelinesAsAdmin"),"PipelinesAsAdmin",PowerBIRESTAPI.PipelinesAsAdmin(),"Table","Table",true}, 115 | {Extension.LoadString("PipelineStagesAsAdmin"),"PipelineStagesAsAdmin",PowerBIRESTAPI.PipelineStagesAsAdmin(),"Table","Table",true}, 116 | {Extension.LoadString("PipelineUsersAsAdmin"),"PipelineUsersAsAdmin",PowerBIRESTAPI.PipelineUsersAsAdmin(),"Table","Table",true}, 117 | {Extension.LoadString("CapacitiesAsAdmin"),"CapacitiesAsAdmin",PowerBIRESTAPI.CapacitiesAsAdmin(),"Table","Table",true}, 118 | {Extension.LoadString("CapacityRefreshablesAsAdmin"),"CapacityRefreshablesAsAdmin",PowerBIRESTAPI.CapacityRefreshablesAsAdmin(),"Table","Table",true} 119 | }), 120 | NavTable = Table.ToNavigationTable(objects, {"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 121 | in 122 | NavTable; 123 | 124 | ExperimentalNavTable = () as table => 125 | let 126 | objects = #table( 127 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 128 | {Extension.LoadString("ReportUsersAsAdmin"),"ReportUsersAsAdmin",PowerBIRESTAPI.ReportUsersAsAdmin(),"Table","Table",true}, 129 | {Extension.LoadString("ReportSubscriptionsAsAdmin"),"ReportSubscriptionsAsAdmin",PowerBIRESTAPI.ReportSubscriptionsAsAdmin(),"Table","Table",true}, 130 | {Extension.LoadString("ReportSubscriptionUsersAsAdmin"),"ReportSubscriptionUsersAsAdmin",PowerBIRESTAPI.ReportSubscriptionUsersAsAdmin(),"Table","Table",true}, 131 | {Extension.LoadString("DatasetUsersAsAdmin"),"DatasetUsersAsAdmin",PowerBIRESTAPI.DatasetUsersAsAdmin(),"Table","Table",true}, 132 | {Extension.LoadString("DataflowUsersAsAdmin"),"DataflowUsersAsAdmin",PowerBIRESTAPI.DataflowUsersAsAdmin(),"Table","Table",true}, 133 | {Extension.LoadString("DashboardUsersAsAdmin"),"DashboardUsersAsAdmin",PowerBIRESTAPI.DashboardUsersAsAdmin(),"Table","Table",true}, 134 | {Extension.LoadString("DashboardSubscriptionsAsAdmin"),"DashboardSubscriptionsAsAdmin",PowerBIRESTAPI.DashboardSubscriptionsAsAdmin(),"Table","Table",true}, 135 | {Extension.LoadString("GatewayDataSourceStatus"),"GatewayDataSourceStatus",PowerBIRESTAPI.GatewayDataSourceStatus(),"Table","Table",true}, 136 | {Extension.LoadString("DatasetDatasourcesAsAdmin"),"DatasetDatasourcesAsAdmin",PowerBIRESTAPI.DatasetDatasourcesAsAdmin(),"Table","Table",true}, 137 | {Extension.LoadString("DataflowDatasourcesAsAdmin"),"DataflowDatasourcesAsAdmin",PowerBIRESTAPI.DataflowDatasourcesAsAdmin(),"Table","Table",true}, 138 | {Extension.LoadString("GatewaysAsAdmin"),"GatewaysAsAdmin",PowerBIRESTAPI.GatewaysAsAdmin(),"Table","Table",true} 139 | }), 140 | NavTable = Table.ToNavigationTable(objects,{"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 141 | in 142 | NavTable; 143 | 144 | FunctionsNavTable = () as table => 145 | let 146 | objects = #table( 147 | {"Name","Key","Data","ItemKind","ItemName","IsLeaf"},{ 148 | {Extension.LoadString("GETData"),"GETData",PowerBIRESTAPI.GETData,"Function","GETData",true}, 149 | {Extension.LoadString("GETRawData"),"GETRawData",PowerBIRESTAPI.GETRawData,"Function","GETRawData",true}, 150 | {"Event Activity Log", "EventActivityLog", PowerBIRESTAPI.EventActivityLog , "Function", "GetActivityLog", true}, 151 | {Extension.LoadString("ExecuteQuery"),"ExecuteQuery",PowerBIRESTAPI.ExecuteQuery,"Function","ExecuteQuery",true}, 152 | {Extension.LoadString("Scorecards"),"Scorecards",PowerBIRESTAPI.Scorecards,"Function","Scorecards",true}, 153 | {Extension.LoadString("Goals"),"Goals",PowerBIRESTAPI.Goals,"Function","Goals",true}, 154 | {Extension.LoadString("ScannerAPIInfo"),"ScannerAPIInfo",PowerBIRESTAPI.ScannerAPIInfo,"Function","ScannerAPIInfo",true}, 155 | {Extension.LoadString("ScannerAPIStatusAndResult"),"ScannerAPIStatusAndResult",PowerBIRESTAPI.ScannerAPIStatusAndResult,"Function","ScannerAPIStatusAndResult",true} 156 | }), 157 | NavTable = Table.ForceToNavigationTable(objects, {"Key"},"Name","Data","ItemKind","ItemName","IsLeaf") 158 | in 159 | NavTable; 160 | 161 | 162 | PowerBIRESTAPI.EventActivityLog = Value.ReplaceType(ActivityLogPagination,ActivityLogType); 163 | 164 | ActivityLogType =type function ( 165 | startdate as ( type date meta[ 166 | Documentation.FieldCaption = "Start Date", 167 | Documentation.FieldDescription = "Start date of your query"]), 168 | enddate as ( type date meta[ 169 | Documentation.FieldCaption = "End Date", 170 | Documentation.FieldDescription = "End date of your query"])) as table meta [ 171 | Documentation.Name = "PowerBIRESTAPI.ActivityLog", 172 | Documentation.LongDescription = "Makes a call to the Power BI REST API Event Activity Log endpoint and returns the full response for the given date range", 173 | Documentation.Examples = {[ 174 | Description = "Makes a call to the Power BI REST API Event Activity Log endpoint and returns the full response for the given date range", 175 | Code = "=PowerBIRESTAPI.ActivityLog(#date(2020,1,1), #date(2020,1,9)) 176 | Get the full documentation at https://msdn.microsoft.com/en-us/library/dn877544.aspx", 177 | Result = "Table response for all event activity logs in the given date range" 178 | ]} 179 | ]; 180 | 181 | ActivityLogPagination = (startdate as date, enddate as date) => 182 | let 183 | Custom2 = List.Dates(startdate, Number.From(enddate - startdate ) + 1, Duration.From(1) ), 184 | Custom3 = List.Transform( Custom2, DateTime.From), 185 | Custom4 = List.Transform(Custom3,each DateTime.ToText(_,"yyyy-MM-ddTHH:mm:ss")), 186 | Custom5 = List.Transform( Custom3, each _ + #duration(0,23,59,59)), 187 | Custom6 = List.Transform(Custom5,each DateTime.ToText(_,"yyyy-MM-ddTHH:mm:ss")), 188 | Custom7 = List.Zip({Custom4, Custom6 } ), 189 | Custom8 = List.Transform( Custom7, each "https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime='"& _{0} &"'&endDateTime='" & _{1}&"'"), 190 | GetData = List.Combine( List.Transform( Custom8, GetActivityLog) ), 191 | TransformedData = Table.Combine( List.Transform( List.Combine(GetData), each Table.FromRecords({_})) ) 192 | in 193 | TransformedData; 194 | 195 | GetActivityLog = (url as text) => 196 | let 197 | Pagination = List.Generate( ()=> 198 | [Call = Json.Document( Web.Contents(url)), next= try Call[continuationUri] otherwise null, Data = try Call[activityEventEntities] otherwise null], 199 | each [Data] <> null, 200 | each [Call = Json.Document( Web.Contents([next])), next= try Call[continuationUri] otherwise null, Data = try Call[activityEventEntities] otherwise null], 201 | each [Data]) 202 | in 203 | Pagination; 204 | 205 | [DataSource.Kind="PowerBIRESTAPI"] 206 | PowerBIRESTAPI.AWDataflowsTransactions = () => 207 | let 208 | source = PowerBIRESTAPI.GroupsDataflows(), 209 | value = Table.SelectColumns( source, {"Workspace ID","Dataflow ID"}), 210 | refreshHistory = Table.AddColumn( value, "Refresh", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/dataflows/"&[Dataflow ID]&"/transactions",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 211 | expandRefresh = Table.ExpandRecordColumn(refreshHistory, "Refresh", {"value"}, {"value"}), 212 | expandList = Table.ExpandListColumn(expandRefresh, "value"), 213 | expandRecord = Table.ExpandRecordColumn(expandList, "value", {"id", "refreshType", "startTime", "endTime", "status"}, {"Refresh ID", "Refresh Type", "Start Time", "End Time", "Status"}), 214 | filterNoRefresh = Table.SelectRows(expandRecord, each ([Refresh ID] <> null)), 215 | changeType = Table.TransformColumnTypes(filterNoRefresh,{{"Refresh ID", type text}, {"Refresh Type", type text}, {"Status", type text}, {"Start Time", type datetimezone}, {"End Time", type datetimezone}}), 216 | addDuration = Table.AddColumn(changeType, "Duration In Minutes", each Duration.TotalMinutes([End Time]-[Start Time]), type number) 217 | in 218 | addDuration; 219 | 220 | [DataSource.Kind="PowerBIRESTAPI"] 221 | PowerBIRESTAPI.MWRefreshHistory = () => 222 | let 223 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/datasets", [Headers = [#"Content-type" = "application/json"]])), 224 | toList = source[value], 225 | toTable = Table.FromList(toList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 226 | columnNames = Table.ExpandRecordColumn(toTable, "Column1", {"id"}, {"Dataset ID"}), 227 | refreshHistory = Table.AddColumn(columnNames, "Call", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/datasets/" & [Dataset ID]&"/refreshes", [Headers = [#"Content-type" = "application/json"]])) otherwise null), 228 | expandCall = Table.ExpandRecordColumn(refreshHistory, "Call", {"value"}, {"value"}), 229 | expandValue = Table.ExpandListColumn(expandCall, "value"), 230 | expandColumns = Table.ExpandRecordColumn(expandValue, "value", {"id", "refreshType", "startTime", "endTime", "status", "requestId", "serviceExceptionJson"}, {"Refresh ID", "Refresh Type", "Start Time", "End Time", "Status", "Request ID", "serviceExceptionJson"}), 231 | parseJSON = Table.TransformColumns(expandColumns,{{"serviceExceptionJson", Json.Document}}), 232 | replaceErrors = Table.ReplaceErrorValues(parseJSON, {{"serviceExceptionJson", null}}), 233 | expandServiceException = Table.ExpandRecordColumn(replaceErrors, "serviceExceptionJson", {"errorCode", "errorDescription"}, {"Error Code", "Error Description"}), 234 | filterNoRefreshes = Table.SelectRows(expandServiceException, each [Refresh ID] <> null and [Refresh ID] <> ""), 235 | changeType = Table.TransformColumnTypes(filterNoRefreshes,{{"Dataset ID", type text}, {"Refresh ID", Int64.Type}, {"Refresh Type", type text}, {"Status", type text}, {"Request ID", type text}, {"Error Code", type text}, {"Error Description", type text}, {"Start Time", type datetimezone}, {"End Time", type datetimezone}}), 236 | addDuration = Table.AddColumn(changeType, "Duration In Minutes", each Duration.TotalMinutes([End Time]-[Start Time]), type number) 237 | in 238 | addDuration; 239 | 240 | [DataSource.Kind="PowerBIRESTAPI"] 241 | PowerBIRESTAPI.AWRefreshHistory = () => 242 | let 243 | source = PowerBIRESTAPI.GroupsDatasets(), 244 | value = Table.SelectColumns( source, {"Workspace ID","Dataset ID"}), 245 | refreshHistory = Table.AddColumn( value, "Refresh", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/datasets/"&[Dataset ID]&"/refreshes",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 246 | expandRefresh = Table.ExpandRecordColumn(refreshHistory, "Refresh", {"value"}, {"value"}), 247 | expandList = Table.ExpandListColumn(expandRefresh, "value"), 248 | expandRecord = Table.ExpandRecordColumn(expandList, "value", {"id", "refreshType", "startTime", "endTime", "serviceExceptionJson", "status", "requestId"}, {"Refresh ID", "Refresh Type", "Start Time", "End Time", "serviceExceptionJson", "Status", "Request ID"}), 249 | parseJSON = Table.TransformColumns(expandRecord,{{"serviceExceptionJson", Json.Document}}), 250 | replaceErrors = Table.ReplaceErrorValues(parseJSON, {{"serviceExceptionJson", null}}), 251 | expandServiceException = Table.ExpandRecordColumn(replaceErrors, "serviceExceptionJson", {"errorCode", "errorDescription"}, {"Error Code", "Error Description"}), 252 | filterNoRefresh = Table.SelectRows(expandServiceException, each ([Refresh ID] <> null)), 253 | changeType = Table.TransformColumnTypes(filterNoRefresh,{{"Refresh ID", Int64.Type}, {"Refresh Type", type text}, {"Error Code", type text}, {"Error Description", type text}, {"Status", type text}, {"Request ID", type text}, {"Start Time", type datetimezone}, {"End Time", type datetimezone}}), 254 | addDuration = Table.AddColumn(changeType, "Duration In Minutes", each Duration.TotalMinutes([End Time]-[Start Time]), type number) 255 | in 256 | addDuration; 257 | 258 | [DataSource.Kind="PowerBIRESTAPI"] 259 | PowerBIRESTAPI.AWRefreshSchedule = () => 260 | let 261 | source = PowerBIRESTAPI.GroupsDatasets(), 262 | value = Table.SelectColumns( source, {"Workspace ID","Dataset ID"}), 263 | refreshSchedule = Table.AddColumn( value, "RefreshSchedule", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/datasets/"&[Dataset ID]&"/refreshSchedule",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 264 | expand = Table.ExpandRecordColumn(refreshSchedule, "RefreshSchedule", {"days", "times", "enabled", "localTimeZoneId", "notifyOption"}, {"Days", "Times", "Scheduled Refresh Enabled", "Time Zone", "Notify Option"}), 265 | extractDays = Table.TransformColumns(expand, {"Days", each Text.Combine(List.Transform(_, Text.From), ","), type text}), 266 | extractTimes = Table.TransformColumns(extractDays, {"Times", each Text.Combine(List.Transform(_, Text.From), ","), type text}), 267 | removeNoRefresh = Table.RemoveRowsWithErrors(extractTimes, {"Days"}), 268 | changeType = Table.TransformColumnTypes(removeNoRefresh,{{"Notify Option", type text}, {"Time Zone", type text}, {"Scheduled Refresh Enabled", type logical}, {"Times", type text}, {"Days", type text}, {"Dataset ID", type text}, {"Workspace ID", type text}}) 269 | in 270 | changeType; 271 | 272 | [DataSource.Kind="PowerBIRESTAPI"] 273 | shared PowerBIRESTAPI.GETData = Value.ReplaceType(GETData, GETDataType); 274 | 275 | GETDataType = type function ( 276 | optional path as ( type text meta[ 277 | Documentation.FieldCaption = "url Path", 278 | Documentation.FieldDescription = "Text string to be added to the https://api.powerbi.com/v1.0/myorg"])) as table meta [ 279 | Documentation.Name = "PowerBIRESTAPI.GETData", 280 | Documentation.LongDescription = "Makes a call to the Power BI REST API and returns the JSON response", 281 | Documentation.Examples = {[ 282 | Description = "Returns raw data from any of the https://api.powerbi.com/v1.0/myorg endpoints. ", 283 | Code = "=PowerBIRESTAPI.GETData(""datasets"") 284 | Get the full documentation at https://msdn.microsoft.com/en-us/library/dn877544.aspx", 285 | Result = "JSON response for all the datasets in the Personal Workspace of the authenticated user." 286 | ]} 287 | ]; 288 | 289 | GETData = (optional path as text) => 290 | let 291 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg", [RelativePath = path])) 292 | in 293 | source; 294 | 295 | [DataSource.Kind="PowerBIRESTAPI"] 296 | shared PowerBIRESTAPI.GETRawData = Value.ReplaceType(GETRawData, GETRawDataType); 297 | 298 | GETRawDataType = type function ( 299 | optional path as ( type text meta[ 300 | Documentation.FieldCaption = "url Path", 301 | Documentation.FieldDescription = "Text string to be added to the https://api.powerbi.com/v1.0/myorg"])) as table meta [ 302 | Documentation.Name = "PowerBIRESTAPI.GETRawData", 303 | Documentation.LongDescription = "Makes a call to the Power BI REST API and returns the raw response", 304 | Documentation.Examples = {[ 305 | Description = "Returns raw data from any of the https://api.powerbi.com/v1.0/myorg endpoints. ", 306 | Code = "=PowerBIRESTAPI.GETData(""datasets"") 307 | Get the full documentation at https://msdn.microsoft.com/en-us/library/dn877544.aspx", 308 | Result = "Raw response for all the datasets in the Personal Workspace of the authenticated user." 309 | ]} 310 | ]; 311 | 312 | GETRawData = (optional path as text) => let source = Web.Contents("https://api.powerbi.com/v1.0/myorg",[RelativePath = path,ManualStatusHandling = {400}]) in source; 313 | 314 | [DataSource.Kind = "PowerBIRESTAPI"] 315 | shared PowerBIRESTAPI.ExecuteQuery = Value.ReplaceType(ExecuteQuery,ExecuteQueryType); 316 | 317 | ExecuteQueryType = 318 | type function (optional datasetId as 319 | ( 320 | type text 321 | meta 322 | [ 323 | Documentation.FieldCaption = "Dataset ID", 324 | Documentation.FieldDescription = "ID of dataset that you want to query.", 325 | Documentation.SampleValues = { 326 | "xxx-xxxx-yyxa..." 327 | } 328 | ] 329 | ), optional daxQuery as 330 | ( 331 | type text 332 | meta 333 | [ 334 | Documentation.FieldCaption = "DAX Query", 335 | Documentation.FieldDescription = "DAX Query that will be executed against dataset. Please dont include ""EVALUATE"" in a code. Connector will automaticaly adds it.", 336 | Documentation.SampleValues = { 337 | "VALUES(Table[Column])" 338 | } 339 | ] 340 | ), optional impersonateUPN as 341 | ( 342 | type text 343 | meta 344 | [ 345 | Documentation.FieldCaption = "UPN of Impersonated User", 346 | Documentation.FieldDescription = "UPN of user that you want to impersonate. !!! This parameter will work only against dataset with RLS !!!", 347 | Documentation.SampleValues = { 348 | "example@domain.com" 349 | } 350 | ] 351 | )) as table 352 | meta 353 | [ 354 | Documentation.Name = "PowerBIRESTAPI.ExecuteQuery", 355 | Documentation.LongDescription = "This call execute query by EXECUTE QUERY endpoint. It can be done only if you have this endpoint avaiable.", 356 | Documentation.Examples = { 357 | [ 358 | Code = "=PowerBIRESTAPI.ExecuteQuery(""xxx-xxxx-yyxa..."",""xxx-xxxx-yyxa..."",""VALUES(Table[Column])"",""example@domain.com"")", 359 | Result = "" 360 | ] 361 | } 362 | ]; 363 | 364 | ExecuteQuery = 365 | (optional datasetId as text, optional daxQuery as text, optional impersonateUPN as text) => 366 | let 367 | functionVarTester = 368 | if 369 | (datasetId <> null and datasetId <> "") and (daxQuery <> null and daxQuery <> "") 370 | then 371 | let 372 | impersonate = 373 | if 374 | impersonateUPN 375 | <> null and impersonateUPN 376 | <> "" 377 | then 378 | ", ""impersonatedUserName"": """ 379 | & impersonateUPN 380 | & """" 381 | else 382 | "", 383 | apiCall = 384 | Json.Document( 385 | Web.Contents( 386 | "https://api.powerbi.com/v1.0/myorg/", 387 | [ 388 | RelativePath = 389 | "datasets/" 390 | & datasetId 391 | & "/executeQueries", 392 | Headers = [ 393 | #"Content-Type" = "application/json" 394 | ], 395 | Content = 396 | Text.ToBinary( 397 | " 398 | { 399 | ""queries"":[ 400 | { 401 | ""query"": ""EVALUATE " 402 | & daxQuery 403 | & """ 404 | } 405 | ], 406 | ""serializerSettings"":{ 407 | ""includeNulls"": false 408 | }" 409 | & impersonate 410 | & " 411 | } 412 | " 413 | ) 414 | ] 415 | ) 416 | ), 417 | output = 418 | let 419 | initSource = apiCall[results]?{0}?[tables]?{0}?[rows]?, 420 | namesOfColumns = List.Buffer(Record.FieldNames(initSource{0})), 421 | correctedColumnsNames = 422 | List.Transform( 423 | namesOfColumns, 424 | each Text.BetweenDelimiters(_, "[", "]") 425 | ), 426 | tableCreator = Table.FromList( 427 | initSource, 428 | Record.FieldValues, 429 | correctedColumnsNames 430 | ) 431 | in 432 | tableCreator 433 | in 434 | output 435 | else 436 | #table(type table [Response = text],{{"Please fill parameters of function."}}) 437 | in 438 | functionVarTester; 439 | 440 | [DataSource.Kind="PowerBIRESTAPI"] 441 | shared PowerBIRESTAPI.GroupsList = () => 442 | let 443 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups", [Headers = [#"Content-type" = "application/json"]])), 444 | toList = source[value], 445 | toTable = Table.FromList(toList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 446 | expandColumns = Table.ExpandRecordColumn(toTable, "Column1", {"id", "isReadOnly", "isOnDedicatedCapacity", "name", "type", "capacityId"}, {"Workspace ID", "Is Read Only", "Is On Dedicated Capacity", "Workspace Name", "Workspace Type", "Capacity ID"}), 447 | changeType = Table.TransformColumnTypes(expandColumns,{{"Workspace ID", type text}, {"Is Read Only", type logical}, {"Is On Dedicated Capacity", type logical}, {"Workspace Type", type text}, {"Workspace Name", type text}, {"Capacity ID", type text}}) 448 | in 449 | changeType; 450 | 451 | [DataSource.Kind="PowerBIRESTAPI"] 452 | PowerBIRESTAPI.GroupsUsers = () => 453 | let 454 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups", [Headers = [#"Content-type" = "application/json"]])), 455 | toList = source[value], 456 | toTable = Table.FromList(toList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 457 | columnNames = Table.ExpandRecordColumn(toTable, "Column1", {"id"}, {"Workspace ID"}), 458 | members = Table.AddColumn(columnNames, "Users", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & Text.From([Workspace ID])&"/users"))[value],{"emailAddress","groupUserAccessRight","displayName","identifier","principalType"},MissingField.UseNull) otherwise null ), 459 | expand = Table.ExpandTableColumn(members, "Users", {"emailAddress", "groupUserAccessRight", "displayName", "identifier", "principalType"}, {"Email Address", "User Role", "User Display Name", "User Identifier", "User Principal Type"}), 460 | changeType = Table.TransformColumnTypes(expand,{{"Workspace ID", type text}, {"Email Address", type text}, {"User Role", type text}, {"User Display Name", type text}, {"User Identifier", type text}, {"User Principal Type", type text}}) 461 | in 462 | changeType; 463 | 464 | [DataSource.Kind="PowerBIRESTAPI"] 465 | shared PowerBIRESTAPI.GroupsDatasets = () => 466 | let 467 | source = PowerBIRESTAPI.GroupsList(), 468 | value = Table.SelectColumns(source, {"Workspace ID"}), 469 | members = Table.AddColumn(value, "Datasets", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & Text.From([Workspace ID])&"/datasets"))[value],{"id","name","addRowsAPIEnabled","configuredBy","isRefreshable","isEffectiveIdentityRequired","isEffectiveIdentityRolesRequired","isOnPremGatewayRequired","targetStorageMode"},MissingField.UseNull) otherwise null ), 470 | expandColumns = Table.ExpandTableColumn(members, "Datasets", {"id", "name", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode"}, {"Dataset ID", "Dataset Name", "Add Rows API Enabled", "Dataset Configured By", "Is Refreshable", "Is Effective Identity Required", "Is Effective Identity Roles Required", "Is On Prem Gateway Required", "Target Storage Mode"}), 471 | changeType = Table.TransformColumnTypes(expandColumns,{{"Dataset ID", type text}, {"Dataset Name", type text}, {"Add Rows API Enabled", type logical}, {"Dataset Configured By", type text}, {"Is Refreshable", type logical}, {"Is Effective Identity Required", type logical}, {"Is Effective Identity Roles Required", type logical}, {"Is On Prem Gateway Required", type logical}, {"Target Storage Mode", type text}}), 472 | filterNoDatasets = Table.SelectRows(changeType, each ([Dataset ID] <> null)) 473 | in 474 | filterNoDatasets; 475 | 476 | [DataSource.Kind="PowerBIRESTAPI"] 477 | PowerBIRESTAPI.MWDatasets = () => 478 | let 479 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/datasets"))[value], 480 | convertToTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 481 | expandColumn = Table.ExpandRecordColumn(convertToTable, "Column1", {"id", "name", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode"}, {"Dataset ID", "Dataset Name", "Add Rows API Enabled", "Dataset Configured By", "Is Refreshable", "Is Effective Identity Required", "Is Effective Identity Roles Required", "Is On Prem Gateway Required", "Target Storage Mode"}), 482 | filterNoDataset = Table.SelectRows(expandColumn, each [Dataset ID] <> null), 483 | changeType = Table.TransformColumnTypes(filterNoDataset,{{"Dataset ID", type text}, {"Dataset Name", type text}, {"Add Rows API Enabled", type logical}, {"Dataset Configured By", type text}, {"Is Refreshable", type logical}, {"Is Effective Identity Required", type logical}, {"Is Effective Identity Roles Required", type logical}, {"Is On Prem Gateway Required", type logical}, {"Target Storage Mode", type text}}) 484 | in 485 | changeType; 486 | 487 | [DataSource.Kind="PowerBIRESTAPI"] 488 | PowerBIRESTAPI.GroupsReports = () => 489 | let 490 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups", [Headers = [#"Content-type" = "application/json"]])), 491 | toList = source[value], 492 | toTable = Table.FromList(toList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 493 | columnNames = Table.ExpandRecordColumn(toTable, "Column1", {"id"}, {"Workspace ID"}), 494 | members = Table.AddColumn( columnNames, "Reports", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & Text.From([Workspace ID])&"/reports") )[value],{"id", "name", "reportType", "webUrl", "embedUrl", "datasetId","endorsementDetails","sensitivityLabel"},MissingField.UseNull ) otherwise null ), 495 | expand = Table.ExpandTableColumn(members, "Reports", {"id", "name", "reportType", "webUrl", "embedUrl", "datasetId","endorsementDetails","sensitivityLabel"}, {"Report ID", "Report Name", "Report Type", "Report Web URL", "Report Embed URL", "Dataset ID","endorsementDetails","sensitivityLabel"}), 496 | filterNoReports = Table.SelectRows(expand, each ([Report ID] <> null)), 497 | ChangeType = Table.TransformColumnTypes(filterNoReports,{{"Workspace ID", type text}, {"Report ID", type text}, {"Report Name", type text}, {"Report Type", type text}, {"Report Web URL", type text}, {"Report Embed URL", type text}, {"Dataset ID", type text}}) 498 | in 499 | ChangeType; 500 | 501 | [DataSource.Kind="PowerBIRESTAPI"] 502 | PowerBIRESTAPI.ReportPages = () => 503 | let 504 | source = PowerBIRESTAPI.GroupsReports(), 505 | filterColumns = Table.SelectColumns(source,{"Workspace ID", "Report ID", "Dataset ID"}), 506 | membersPages = Table.AddColumn( filterColumns, "Pages", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/reports/" & Text.From([Report ID])&"/pages") )[value],{"displayName", "Name", "order"},MissingField.UseNull ) otherwise null ), 507 | expandPages = Table.ExpandTableColumn(membersPages, "Pages", {"displayName", "Name", "order"}, {"Display Name", "Name", "Order"}), 508 | changeType = Table.TransformColumnTypes(expandPages,{{"Display Name", type text}, {"Name", type text}, {"Order", Int64.Type}}), 509 | filterNoReportPages = Table.SelectRows(changeType, each ([Display Name] <> null)) 510 | in 511 | filterNoReportPages; 512 | 513 | [DataSource.Kind="PowerBIRESTAPI"] 514 | shared PowerBIRESTAPI.MWReports = () => 515 | let 516 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/reports"))[value], 517 | convertToTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 518 | expandColumns = Table.ExpandRecordColumn(convertToTable, "Column1", {"id", "reportType", "name", "webUrl", "embedUrl", "isOwnedByMe", "datasetId", "appId","endorsementDetails","sensitivityLabel"}, {"Report ID", "Report Type", "Report Name", "Web URL", "Embed URL", "Is Owned By Me", "Dataset ID", "App Id","endorsementDetails","sensitivityLabel"}), 519 | changeType = Table.TransformColumnTypes(expandColumns,{{"Report ID", type text}, {"Report Type", type text}, {"Report Name", type text}, {"Web URL", type text}, {"Embed URL", type text}, {"Is Owned By Me", type logical}, {"Dataset ID", type text}, {"App Id", type text}}) 520 | in 521 | changeType; 522 | 523 | [DataSource.Kind="PowerBIRESTAPI"] 524 | PowerBIRESTAPI.GroupsDashboards = () => 525 | let 526 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups", [Headers = [#"Content-type" = "application/json"]])), 527 | toList = source[value], 528 | toTable = Table.FromList(toList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 529 | columnNames = Table.ExpandRecordColumn(toTable, "Column1", {"id"}, {"Workspace ID"}), 530 | members = Table.AddColumn(columnNames, "Dashboards", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & Text.From([Workspace ID])&"/dashboards"))[value],{"id","displayName","embedUrl","isReadOnly"},MissingField.UseNull) otherwise null ), 531 | expandDashboards = Table.ExpandTableColumn(members, "Dashboards", {"id","displayName","embedUrl","isReadOnly"}, {"Dashboard ID", "Dashboard Name", "Dashboard Embed URL", "Is Read Only"}), 532 | FilterEmptyWorkspaces = Table.SelectRows(expandDashboards, each ([Dashboard ID] <> null)), 533 | changeType = Table.TransformColumnTypes(FilterEmptyWorkspaces,{{"Workspace ID", type text}, {"Dashboard ID", type text}, {"Dashboard Name", type text}, {"Dashboard Embed URL", type text}, {"Is Read Only", type logical}}) 534 | in 535 | changeType; 536 | 537 | [DataSource.Kind="PowerBIRESTAPI"] 538 | PowerBIRESTAPI.MWApps = () => 539 | let 540 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/apps"))[value], 541 | toTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 542 | expandColumns = Table.ExpandRecordColumn(toTable, "Column1", {"id", "name", "lastUpdate", "description", "publishedBy"}, {"App ID", "App Name", "App Last Updated", "App Description", "App Published By"}), 543 | changeType = Table.TransformColumnTypes(expandColumns,{{"App ID", type text}, {"App Name", type text}, {"App Description", type text}, {"App Published By", type text}, {"App Last Updated", type datetimezone}}) 544 | in 545 | changeType; 546 | 547 | [DataSource.Kind="PowerBIRESTAPI"] 548 | PowerBIRESTAPI.GroupsDashboardTiles = () => 549 | let 550 | source = PowerBIRESTAPI.GroupsDashboards(), 551 | value = Table.SelectColumns( source, {"Workspace ID","Dashboard ID"}), 552 | datasources = Table.AddColumn( value, "Tiles", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/dashboards/"&[Dashboard ID]&"/tiles",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 553 | toList = Table.ExpandRecordColumn(datasources, "Tiles", {"value"}, {"Tiles.value"}), 554 | expandList = Table.ExpandListColumn(toList, "Tiles.value"), 555 | expandFields = Table.ExpandRecordColumn(expandList, "Tiles.value", {"id", "reportId", "datasetId", "title", "subTitle", "embedUrl", "action"}, {"Dashboard Tile ID", "Report ID", "Dataset ID", "Tile Title", "Tile Subtitle", "Tile Embed URL", "Tile Action"}), 556 | expandAction = Table.ExpandRecordColumn(expandFields, "Tile Action", {"openUrl"}, {"openUrl"}), 557 | expandURL = Table.ExpandRecordColumn(expandAction, "openUrl", {"targetUrl"}, {"Target URL"}), 558 | changeType = Table.TransformColumnTypes(expandURL,{{"Workspace ID", type text}, {"Dashboard ID", type text}, {"Dashboard Tile ID", type text}, {"Report ID", type text}, {"Dataset ID", type text}, {"Tile Title", type text}, {"Tile Subtitle", type text}, {"Tile Embed URL", type text}, {"Target URL", type text}}) 559 | in 560 | changeType; 561 | 562 | [DataSource.Kind="PowerBIRESTAPI"] 563 | shared PowerBIRESTAPI.MWDashboards = () => 564 | let 565 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/dashboards"))[value], 566 | convertToTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 567 | expandColumn = Table.ExpandRecordColumn(convertToTable, "Column1", {"id", "displayName", "isReadOnly", "embedUrl", "dataClassification", "appId"}, {"Dashboard ID", "Dashboard Name", "Is Read Only", "Embed URL", "Data Classification", "App ID"}), 568 | changeType = Table.TransformColumnTypes(expandColumn,{{"App ID", type text}, {"Data Classification", type text}, {"Embed URL", type text}, {"Is Read Only", type logical}, {"Dashboard Name", type text}, {"Dashboard ID", type text}}) 569 | in 570 | changeType; 571 | 572 | [DataSource.Kind="PowerBIRESTAPI"] 573 | PowerBIRESTAPI.GroupsDatasources = () => 574 | let 575 | source = PowerBIRESTAPI.GroupsDatasets(), 576 | value = Table.SelectColumns( source, {"Workspace ID","Dataset ID"}), 577 | datasources = Table.AddColumn( value, "Datasources", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/datasets/"&[Dataset ID]&"/datasources",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 578 | expandDatasources = Table.ExpandRecordColumn(datasources, "Datasources", {"value"}, {"value"}), 579 | toList = Table.ExpandListColumn(expandDatasources, "value"), 580 | expandRecords = Table.ExpandRecordColumn(toList, "value", {"datasourceId", "gatewayId", "datasourceType", "connectionDetails"}, {"Datasource ID", "Gateway ID","Datasource Type", "connectionDetails"}), 581 | expandConnectionDetails = Table.ExpandRecordColumn(expandRecords, "connectionDetails", {"url", "path", "kind", "server", "database", "connectionString", "emailAddress", "domain"}, {"url", "path", "kind", "server", "database", "connectionString", "emailAddress", "domain"}), 582 | ServerAndDB = Table.AddColumn(expandConnectionDetails,"Server And Database", each [server]&" | "&[database]), 583 | ExtensionFull = Table.AddColumn(ServerAndDB, "ExtensionFull", each [kind] & " | " & [path]), 584 | ConnectionInfo = Table.AddColumn(ExtensionFull, "Connection Information", each if [Datasource Type] = "AnalysisServices" then [Server And Database] 585 | else if [Datasource Type] = "ODBC" then [connectionString] 586 | else if [Datasource Type] = "Sql" then [Server And Database] 587 | else if [Datasource Type] = "DB2" then [Server And Database] 588 | else if [Datasource Type] = "File" then [path] 589 | else if [Datasource Type] = "ActiveDirectory" then [domain] 590 | else if [Datasource Type] = "Folder" then [path] 591 | else if [Datasource Type] = "Web" then [url] 592 | else if [Datasource Type] = "MySql" then [Server And Database] 593 | else if [Datasource Type] = "OData" then [url] 594 | else if [Datasource Type] = "SharePointList" then [url] 595 | else if [Datasource Type] = "Extension" then [ExtensionFull] 596 | else if [Datasource Type] = "Oracle" then [server] 597 | else if [Datasource Type] = "Teradata" then [server] 598 | else if [Datasource Type] = "Exchange" then [emailAddress] 599 | else if [Datasource Type] = "OleDb" then [connectionString] 600 | else if [Datasource Type] = "AzureBlobs" then [account] & " | " & [domain] 601 | else "Requires Mapping"), 602 | filterNoDatasource = Table.SelectRows(ConnectionInfo, each ([Datasource Type] <> null)), 603 | removeColumns = Table.RemoveColumns(filterNoDatasource,{"url", "path", "kind", "server", "database", "connectionString", "emailAddress", "domain", "Server And Database", "ExtensionFull"}), 604 | ChangeType = Table.TransformColumnTypes(removeColumns,{{"Connection Information", type text}, {"Datasource Type", type text}, {"Gateway ID", type text}, {"Datasource ID", type text}, {"Dataset ID", type text}, {"Workspace ID", type text}}) 605 | in 606 | ChangeType; 607 | 608 | [DataSource.Kind="PowerBIRESTAPI"] 609 | PowerBIRESTAPI.GroupsDatasetToDataflowsLinks = () => 610 | let 611 | source = PowerBIRESTAPI.GroupsList(), 612 | value = Table.SelectColumns( source, {"Workspace ID"}), 613 | datasetToDataflowLinks = Table.AddColumn( value, "datasetToDataflowLinks", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/datasets/upstreamDataflows",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 614 | #"Expanded datasetToDataflowLinks" = Table.ExpandRecordColumn(datasetToDataflowLinks, "datasetToDataflowLinks", {"value"}, {"value"}), 615 | #"Expanded value" = Table.ExpandListColumn(#"Expanded datasetToDataflowLinks", "value"), 616 | #"Expanded value1" = Table.ExpandRecordColumn(#"Expanded value", "value", {"datasetObjectId", "dataflowObjectId"}, {"Dataset ID", "Dataflow ID"}), 617 | #"Filtered Rows" = Table.SelectRows(#"Expanded value1", each [Dataset ID] <> null), 618 | #"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows",{{"Dataset ID", type text}, {"Dataflow ID", type text}}) 619 | in 620 | #"Changed Type"; 621 | 622 | [DataSource.Kind="PowerBIRESTAPI"] 623 | PowerBIRESTAPI.GroupsDataflows = () => 624 | let 625 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups", [Headers = [#"Content-type" = "application/json"]])), 626 | toList = source[value], 627 | toTable = Table.FromList(toList, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 628 | columnNames = Table.ExpandRecordColumn(toTable, "Column1", {"id"}, {"Workspace ID"}), 629 | members = Table.AddColumn(columnNames, "Dataflows", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/groups/" & Text.From([Workspace ID])&"/dataflows") )[value],{"objectId", "name", "description", "configuredBy"},MissingField.UseNull ) otherwise null ), 630 | expand = Table.ExpandTableColumn(members, "Dataflows", {"objectId", "name", "description", "configuredBy"}, {"Dataflow ID", "Dataflow Name", "Dataflow Description", "Dataflow Configured By"}), 631 | filterNoDataflow = Table.SelectRows(expand, each ([Dataflow ID] <> null)), 632 | changeType = Table.TransformColumnTypes(filterNoDataflow,{{"Workspace ID", type text}, {"Dataflow ID", type text}, {"Dataflow Name", type text}, {"Dataflow Description", type text}, {"Dataflow Configured By", type text}}) 633 | in 634 | changeType; 635 | 636 | [DataSource.Kind="PowerBIRESTAPI"] 637 | PowerBIRESTAPI.GroupsDataflowDataSources = () => 638 | let 639 | source = PowerBIRESTAPI.GroupsDataflows(), 640 | value = Table.SelectColumns( source, {"Workspace ID","Dataflow ID"}), 641 | datasources = Table.AddColumn( value, "Datasources", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/dataflows/"&[Dataflow ID]&"/datasources",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 642 | expandDatasources = Table.ExpandRecordColumn(datasources, "Datasources", {"value"}, {"value"}), 643 | toList = Table.ExpandListColumn(expandDatasources, "value"), 644 | expandRecords = Table.ExpandRecordColumn(toList, "value", {"datasourceId", "gatewayId", "datasourceType", "connectionDetails"}, {"Datasource ID", "Gateway ID","Datasource Type", "connectionDetails"}), 645 | expandConnectionDetails = Table.ExpandRecordColumn(expandRecords, "connectionDetails", {"url", "extensionDataSourcePath", "extensionDataSourceKind", "server", "database", "connectionString", "sharePointSiteUrl","emailAddress", "domain","path"}, {"url", "extensionDataSourcePath", "extensionDataSourceKind", "server", "database", "connectionString","sharePointSiteUrl", "emailAddress", "domain","path"}), 646 | ServerAndDB = Table.AddColumn(expandConnectionDetails,"Server And Database", each [server]&" | "&[database]), 647 | ExtensionFull = Table.AddColumn(ServerAndDB, "ExtensionFull", each [extensionDataSourceKind] & " | " & [extensionDataSourcePath]), 648 | ConnectionInfo = Table.AddColumn(ExtensionFull, "Connection Information", each if [Datasource Type] = "AnalysisServices" then [Server And Database] 649 | else if [Datasource Type] = "ODBC" then [connectionString] 650 | else if [Datasource Type] = "Sql" then [Server And Database] 651 | else if [Datasource Type] = "DB2" then [Server And Database] 652 | else if [Datasource Type] = "File" then [path] 653 | else if [Datasource Type] = "ActiveDirectory" then [domain] 654 | else if [Datasource Type] = "Folder" then [path] 655 | else if [Datasource Type] = "Web" then [url] 656 | else if [Datasource Type] = "MySql" then [Server And Database] 657 | else if [Datasource Type] = "OData" then [url] 658 | else if [Datasource Type] = "SharePointList" then [sharePointSiteUrl] 659 | else if [Datasource Type] = "Extension" then [ExtensionFull] 660 | else if [Datasource Type] = "Teradata" then [server] 661 | else if [Datasource Type] = "Oracle" then [server] 662 | else if [Datasource Type] = "Exchange" then [emailAddress] 663 | else if [Datasource Type] = "OleDb" then [connectionString] 664 | else "Requires Mapping"), 665 | filterNoDatasource = Table.SelectRows(ConnectionInfo, each ([Datasource Type] <> null)), 666 | removeColumns = Table.RemoveColumns(filterNoDatasource,{"url", "path", "extensionDataSourcePath", "extensionDataSourceKind", "server", "database", "connectionString", "sharePointSiteUrl","emailAddress", "domain", "Server And Database", "ExtensionFull"}), 667 | ChangeType = Table.TransformColumnTypes(removeColumns,{{"Connection Information", type text}, {"Datasource Type", type text}, {"Gateway ID", type text}, {"Datasource ID", type text}, {"Dataflow ID", type text}, {"Workspace ID", type text}}) 668 | in 669 | ChangeType; 670 | 671 | [DataSource.Kind="PowerBIRESTAPI"] 672 | PowerBIRESTAPI.GroupsDataflowUpstreamDataflows = () => 673 | let 674 | source = PowerBIRESTAPI.GroupsDataflows(), 675 | value = Table.SelectColumns( source, {"Workspace ID","Dataflow ID"}), 676 | upstreamDataflows = Table.AddColumn( value, "upstreamDataflows", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/groups/"&[Workspace ID]&"/dataflows/"&[Dataflow ID]&"/upstreamDataflows",[Headers=[#"Content-type" = "application/json"]])) otherwise null), 677 | #"Expanded upstreamDataflows" = Table.ExpandRecordColumn(upstreamDataflows, "upstreamDataflows", {"value"}, {"value"}), 678 | #"Expanded value" = Table.ExpandListColumn(#"Expanded upstreamDataflows", "value"), 679 | #"Expanded value1" = Table.ExpandRecordColumn(#"Expanded value", "value", {"targetDataflowId", "groupId"}, {"Upstream Dataflow ID", "Upstream Workspace ID"}), 680 | #"Changed Type" = Table.TransformColumnTypes(#"Expanded value1",{{"Upstream Dataflow ID", type text}, {"Upstream Workspace ID", type text}}) 681 | in 682 | #"Changed Type"; 683 | 684 | [DataSource.Kind="PowerBIRESTAPI"] 685 | PowerBIRESTAPI.Gateways = () => 686 | let 687 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/gateways"))[value], 688 | ToTable = Table.FromRecords(source), 689 | columnNames = Table.RenameColumns(ToTable,{{"id", "Gateway ID"}, {"name", "Gateway Name"}}), 690 | members = Table.AddColumn( columnNames, "GW", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/gateways/" & [Gateway ID], [Headers = [#"Content-type" = "application/json"]])) otherwise null), 691 | ExpandStatus= Table.ExpandRecordColumn(members, "GW", {"gatewayStatus"}, {"Gateway Status"}), 692 | ConvertToJSON = Table.TransformColumns(ExpandStatus,{{"gatewayAnnotation", Json.Document}}), 693 | ExpandAnnotation = Table.ExpandRecordColumn(ConvertToJSON, "gatewayAnnotation", {"gatewayContactInformation", "gatewayVersion", "gatewayMachine", "gatewayDepartment"}, {"Gateway Contact Information", "Gateway Version", "Gateway Machine Name", "Gateway Department"}), 694 | ExpandContact = Table.TransformColumns(ExpandAnnotation, {"Gateway Contact Information", each Text.Combine(List.Transform(_, Text.From)), type text}), 695 | RemoveColumns= Table.RemoveColumns(ExpandContact,{"gatewayId", "type", "publicKey"}), 696 | ChangeType = Table.TransformColumnTypes(RemoveColumns,{{"Gateway ID", type text}, {"Gateway Name", type text}, {"Gateway Contact Information", type text}, {"Gateway Version", type text}, {"Gateway Machine Name", type text}, {"Gateway Department", type text}, {"Gateway Status", type text}}) 697 | in 698 | ChangeType; 699 | 700 | [DataSource.Kind="PowerBIRESTAPI"] 701 | PowerBIRESTAPI.GatewaysAsAdmin = () => 702 | let 703 | apiCall = 704 | Json.Document( 705 | Web.Contents( 706 | "https://api.powerbi.com/v2.0/myorg", 707 | [ 708 | RelativePath = "gatewayclusters?$expand=permissions,memberGateways&$skip=0", 709 | Headers = [ 710 | #"Content-Type" = "application/json" 711 | ] 712 | ] 713 | ) 714 | ), 715 | output = 716 | #table( 717 | type table [ 718 | id = text, 719 | name = text, 720 | #"type" = text, 721 | loadBalancingSettings = text, 722 | options = record, 723 | staticCapabilities = number, 724 | permissions = list, 725 | memberGateways = list, 726 | datasources = list, 727 | maxPermission = record 728 | ], 729 | List.Transform( 730 | apiCall[value], 731 | each 732 | { 733 | _[id]?, 734 | _[name]?, 735 | _[#"type"]?, 736 | _[loadBalancingSettings]?, 737 | _[options]?, 738 | Number.From(_[staticCapabilities]?), 739 | _[permissions]?, 740 | _[memberGateways]?, 741 | _[datasources]?, 742 | _[maxPermission]? 743 | } 744 | ) 745 | ) 746 | in 747 | output; 748 | 749 | [DataSource.Kind="PowerBIRESTAPI"] 750 | PowerBIRESTAPI.GatewayDataSourceStatus = () => 751 | let 752 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/gateways"))[value], 753 | ToTable = Table.FromRecords(source), 754 | columnNames = Table.RenameColumns(ToTable,{{"id", "Gateway ID"}}), 755 | members = Table.AddColumn(columnNames, "Gateway Data Sources", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/gateways/" & Text.From([Gateway ID])&"/datasources"))[value] ) otherwise null ), 756 | Columns = Table.SelectColumns(members,{"Gateway ID", "Gateway Data Sources"}), 757 | Expanded = Table.ExpandTableColumn(Columns, "Gateway Data Sources", {"id"}, {"Gateway Datasource ID"}), 758 | datasources = Table.AddColumn(Expanded, "statusJSON", each try Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/gateways/"&[Gateway ID]&"/datasources/"&[Gateway Datasource ID]&"/status",[ManualStatusHandling = {400}]),65001) otherwise "ok"), 759 | details = Table.AddColumn(datasources, "Error Message", each try List.Select([statusJSON][error][pbi.error][details], each _[code] ="DM_ErrorDetailNameCode_UnderlyingErrorMessage"){0}[detail][value] otherwise null, type text), 760 | code = Table.AddColumn(details, "Error Code", each try [Status][error][code]{0}[code][value] otherwise null), 761 | errorFlag = Table.AddColumn(code, "Error Flag", each if [statusJSON] = "ok" then "No" else "Yes", type text), 762 | selectColumns = Table.SelectColumns(errorFlag,{"Gateway ID","Gateway Datasource ID","Error Flag","Error Code","Error Message"}), 763 | ChangeType = Table.TransformColumnTypes(selectColumns,{{"Gateway ID", type text}, {"Gateway Datasource ID", type text}}) 764 | in 765 | ChangeType; 766 | 767 | [DataSource.Kind="PowerBIRESTAPI"] 768 | PowerBIRESTAPI.GatewayDataSources = () => 769 | let 770 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/gateways"))[value], 771 | ToTable = Table.FromRecords(source), 772 | columnNames = Table.RenameColumns(ToTable,{{"id", "Gateway ID"}}), 773 | members = Table.AddColumn(columnNames, "Gateway Data Sources", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/gateways/" & Text.From([Gateway ID])&"/datasources") )[value] ) otherwise null ), 774 | Columns = Table.SelectColumns(members,{"Gateway ID", "Gateway Data Sources"}), 775 | Expanded = Table.ExpandTableColumn(Columns, "Gateway Data Sources", {"id", "datasourceType", "connectionDetails", "credentialType","datasourceName"}, {"Gateway Datasource ID", "Data Source Type", "Connection Details", "Credential Type", "Data Source Name"}), 776 | ConvertConnectionToJSON = Table.AddColumn(Expanded, "Connections", each Json.Document([Connection Details])), 777 | ExpandedConnection = Table.ExpandRecordColumn(ConvertConnectionToJSON, "Connections", {"url", "connectionString", "server", "database","extensionDataSourceKind","extensionDataSourcePath","sharePointSiteUrl","domain","path"}, {"URL", "Connection String", "Server Name", "Database Name","extensionDataSourceKind","extensionDataSourcePath","sharePointSiteUrl","domain","path"}), 778 | ServerAndDB = Table.AddColumn(ExpandedConnection, "Server And Database", each [Server Name]&" | "&[Database Name]), 779 | ExtensionFull = Table.AddColumn(ServerAndDB, "ExtensionFull", each [extensionDataSourceKind] & " | " & [extensionDataSourcePath]), 780 | ConnectionInfo = Table.AddColumn(ExtensionFull, "Connection Information", each if [Data Source Type] = "AnalysisServices" then [Server And Database] 781 | else if [Data Source Type] = "ODBC" then [Connection String] 782 | else if [Data Source Type] = "Sql" then [Server And Database] 783 | else if [Data Source Type] = "DB2" then [Server And Database] 784 | else if [Data Source Type] = "File" then [path] 785 | else if [Data Source Type] = "ActiveDirectory" then [domain] 786 | else if [Data Source Type] = "Folder" then [path] 787 | else if [Data Source Type] = "Web" then [URL] 788 | else if [Data Source Type] = "MySql" then [Server And Database] 789 | else if [Data Source Type] = "OData" then [URL] 790 | else if [Data Source Type] = "SharePointList" then [sharePointSiteUrl] 791 | else if [Data Source Type] = "Extension" then [ExtensionFull] 792 | else if [Data Source Type] = "Oracle" then [Server Name] 793 | else if [Data Source Type] = "Teradata" then [Server Name] 794 | else if [Data Source Type] = "PostgreSql" then [Server Name] 795 | else if [Data Source Type] = "OleDb" then [Connection String] 796 | else "Requires Mapping"), 797 | filterNoDatasource = Table.SelectRows(ConnectionInfo, each ([Gateway Datasource ID] <> null)), 798 | RemoveColumns = Table.RemoveColumns(filterNoDatasource,{"Connection Details", "URL", "Connection String", "Server Name", "Database Name", "extensionDataSourceKind", "extensionDataSourcePath", "sharePointSiteUrl", "domain", "path", "Server And Database", "ExtensionFull"}), 799 | ChangeType = Table.TransformColumnTypes(RemoveColumns,{{"Gateway ID", type text}, {"Gateway Datasource ID", type text}, {"Data Source Type", type text}, {"Credential Type", type text}, {"Data Source Name", type text}, {"Connection Information", type text}}) 800 | in 801 | ChangeType; 802 | 803 | [DataSource.Kind="PowerBIRESTAPI"] 804 | PowerBIRESTAPI.GatewayDataSourceUsers = () => 805 | let 806 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/gateways"))[value], 807 | ToTable = Table.FromRecords(source), 808 | columnNames = Table.RenameColumns(ToTable,{{"id", "Gateway ID"}}), 809 | members = Table.AddColumn(columnNames, "Gateway Data Sources", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/gateways/" & Text.From([Gateway ID])&"/datasources") )[value] ) otherwise null ), 810 | Columns = Table.SelectColumns(members,{"Gateway ID", "Gateway Data Sources"}), 811 | Expanded = Table.ExpandTableColumn(Columns, "Gateway Data Sources", {"id"}, {"Gateway Datasource ID"}), 812 | Columns2 = Table.SelectColumns(Expanded,{"Gateway ID", "Gateway Datasource ID"}), 813 | members2 = Table.AddColumn(Columns2, "Gateway Data Source Users", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/gateways/" & Text.From([Gateway ID])&"/datasources/" & Text.From([Gateway Datasource ID])& "/users"))[value],{"emailAddress","groupUserAccessRight","displayName","identifier","principalType"},MissingField.UseNull ) otherwise null ), 814 | Expanded2 = Table.ExpandTableColumn(members2, "Gateway Data Source Users", {"emailAddress", "datasourceAccessRight", "displayName", "identifier", "principalType"}, {"Data Source User Email Address", "Data Source Permission Level", "Data Source User Name", "Data Source User Identifier", "Data Source User Type"}), 815 | filterNoDataSource = Table.SelectRows(Expanded2, each ([Gateway Datasource ID] <> null)), 816 | ChangeType = Table.TransformColumnTypes(filterNoDataSource,{{"Data Source User Type", type text}, {"Data Source User Identifier", type text}, {"Data Source User Name", type text}, {"Data Source Permission Level", type text}, {"Data Source User Email Address", type text}, {"Gateway Datasource ID", type text}, {"Gateway ID", type text}}) 817 | in 818 | ChangeType; 819 | 820 | [DataSource.Kind="PowerBIRESTAPI"] 821 | PowerBIRESTAPI.GroupsAsAdmin = () => 822 | let 823 | BaseUrl = "https://api.powerbi.com/v1.0/myorg/admin/Groups?$expand=reports,users,datasets,dataflows,dashboards", 824 | EntitiesPerPage = 5000, 825 | 826 | GetJson = (Url) => 827 | let RawData = Web.Contents(Url), 828 | Json = Json.Document(RawData) 829 | in 830 | Json, 831 | 832 | GetEntityCount = () => 833 | let Url = BaseUrl & "&$top=1", 834 | Json = GetJson(Url), 835 | Count = Json[#"@odata.count"] 836 | in 837 | Count, 838 | 839 | GetPage = (Index) => 840 | let Skip = "$skip=" & Text.From(Index * EntitiesPerPage), 841 | Top = "$top=" & Text.From(EntitiesPerPage), 842 | Url = BaseUrl & "&" & Skip & "&" & Top, 843 | Json = GetJson(Url), 844 | Value = Json[#"value"] 845 | in 846 | Value, 847 | 848 | EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }), 849 | PageCount = Number.RoundUp(EntityCount / EntitiesPerPage), 850 | PageIndices = { 0 .. PageCount - 1 }, 851 | Pages = List.Transform(PageIndices, each GetPage(_)), 852 | Entities = List.Union(Pages), 853 | Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 854 | expandColumns = Table.ExpandRecordColumn(Table, "Column1", {"id", "name", "isReadOnly", "isOnDedicatedCapacity", "capacityMigrationStatus", "capacityId", "description", "type", "state", "upstreamDataflowsOfDatasets", "reports", "users", "datasets", "dataflows", "dashboards"}, {"Workspace ID", "Workspace Name", "Is Read Only", "Is On Dedicated Capacity", "Capacity Migration Status", "capacityId", "Workspace Description", "Workspace Type", "Workspace State", "upstreamDataflowsOfDatasets", "reports", "users", "datasets", "dataflows", "dashboards"}), 855 | changeType = Table.TransformColumnTypes(expandColumns,{{"Is Read Only", type logical}, {"Is On Dedicated Capacity", type logical}, {"Workspace ID", type text}, {"Workspace Name", type text}, {"Capacity Migration Status", type text}, {"capacityId", type text}, {"Workspace Description", type text}, {"Workspace Type", type text}, {"Workspace State", type text}}) 856 | in 857 | changeType; 858 | 859 | 860 | [DataSource.Kind="PowerBIRESTAPI"] 861 | PowerBIRESTAPI.GroupUsersAsAdmin = () => 862 | let 863 | source = PowerBIRESTAPI.GroupsAsAdmin(), 864 | trimColumns = Table.SelectColumns(source,{"Workspace ID", "Workspace Type", "Workspace State", "users"}), 865 | convertToRecords = Table.ExpandListColumn(trimColumns, "users"), 866 | expandRecords = Table.ExpandRecordColumn(convertToRecords, "users", {"emailAddress", "groupUserAccessRight", "identifier", "principalType", "displayName"}, {"Email Address", "User Access Rights", "User Identifier", "User Principal Type", "Workspace User Display Name"}), 867 | changeType = Table.TransformColumnTypes(expandRecords,{{"Email Address", type text}, {"User Access Rights", type text}, {"User Identifier", type text}, {"User Principal Type", type text}, {"Workspace User Display Name", type text}}) 868 | in 869 | changeType; 870 | 871 | 872 | [DataSource.Kind="PowerBIRESTAPI"] 873 | PowerBIRESTAPI.ReportsAsAdmin = () => 874 | let 875 | source = PowerBIRESTAPI.GroupsAsAdmin(), 876 | trimColumns = Table.SelectColumns(source,{"Workspace ID", "reports"}), 877 | convertToRecords = Table.ExpandListColumn(trimColumns, "reports"), 878 | expandRecords = Table.ExpandRecordColumn(convertToRecords, "reports", {"id", "reportType", "name", "datasetId", "appId"}, {"Report ID", "Report Type", "Report Name", "Dataset ID", "App ID"}), 879 | filterNoReports = Table.SelectRows(expandRecords, each ([Report ID] <> null)), 880 | changeType = Table.TransformColumnTypes(filterNoReports,{{"Report ID", type text}, {"Report Type", type text}, {"Report Name", type text}, {"Dataset ID", type text}, {"App ID", type text}}) 881 | in 882 | changeType; 883 | 884 | 885 | [DataSource.Kind="PowerBIRESTAPI"] 886 | PowerBIRESTAPI.ReportSubscriptionsAsAdmin = () => 887 | let 888 | source = PowerBIRESTAPI.ReportsAsAdmin(), 889 | trimColumns = Table.SelectColumns(source,{"Report ID"}), 890 | subscriptions = Table.AddColumn(trimColumns, "Subscriptions", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/reports/" & Text.From([Report ID])&"/subscriptions") )[value],{"id", "title", "artifactId", "artifactDisplayName", "subArtifactDisplayName", "artifactType", "isEnabled", "frequency", "startDate", "endDate", "linkToContent", "previewImage", "attachmentFormat", "users"},MissingField.UseNull) otherwise null ), 891 | trimColumns2 = Table.SelectColumns(subscriptions,{"Subscriptions"}), 892 | expandSubscriptions = Table.ExpandTableColumn(trimColumns2, "Subscriptions", {"id", "title", "artifactId", "artifactDisplayName", "subArtifactDisplayName", "artifactType", "isEnabled", "frequency", "startDate", "endDate", "linkToContent", "previewImage", "attachmentFormat", "users"}, {"Subscription ID", "Subscription Name", "Report ID", "Report Name", "Report Page Name", "Report Type", "Is Enabled", "Frequency", "Start Date", "End Date", "Link To Content", "Preview Image", "Attachment Format", "Users"}), 893 | filterNoSubscriptions = Table.SelectRows(expandSubscriptions, each [Subscription ID] <> null and [Subscription ID] <> ""), 894 | parsedDate = Table.TransformColumns(filterNoSubscriptions,{{"End Date", each Date.From(DateTimeZone.From(_)), type date}, {"Start Date", each Date.From(DateTimeZone.From(_)), type date}}), 895 | changedType = Table.TransformColumnTypes(parsedDate,{{"Link To Content", type logical}, {"Preview Image", type logical}, {"Is Enabled", type logical}}) 896 | in 897 | changedType; 898 | 899 | [DataSource.Kind="PowerBIRESTAPI"] 900 | PowerBIRESTAPI.ReportSubscriptionUsersAsAdmin = () => 901 | let 902 | source = PowerBIRESTAPI.ReportSubscriptionsAsAdmin(), 903 | trimColumns = Table.SelectColumns(source,{"Subscription ID", "Users"}), 904 | expandUsersAndGroups = Table.ExpandRecordColumn(Table.ExpandListColumn(trimColumns, "Users"), "Users", {"emailAddress", "displayName", "identifier", "graphId", "principalType", "userType"}, {"Email Address", "Display Name", "Identifier", "Graph ID", "Principal Type", "User Type"}) 905 | in 906 | expandUsersAndGroups; 907 | 908 | [DataSource.Kind="PowerBIRESTAPI"] 909 | PowerBIRESTAPI.ReportUsersAsAdmin = () => 910 | let 911 | source = PowerBIRESTAPI.ReportsAsAdmin(), 912 | trimColumns = Table.SelectColumns(source,{"Report ID"}), 913 | addColumn = Table.AddColumn(trimColumns, "Users", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/reports/" & Text.From([Report ID])&"/users"))[value],{"emailAddress","reportUserAccessRight","displayName","identifier","principalType","graphId"},MissingField.UseNull ) otherwise null ), 914 | expand = Table.ExpandTableColumn(addColumn, "Users", {"emailAddress", "reportUserAccessRight", "displayName", "identifier", "principalType", "graphId"}, {"Email Address", "User Access Level", "Display Name", "Identifier", "Principal Type", "Graph ID"}), 915 | changeType = Table.TransformColumnTypes(expand,{{"Email Address", type text}, {"User Access Level", type text}, {"Display Name", type text}, {"Identifier", type text}, {"Principal Type", type text}, {"Graph ID", type text}}) 916 | in 917 | changeType; 918 | 919 | 920 | [DataSource.Kind="PowerBIRESTAPI"] 921 | PowerBIRESTAPI.DatasetUsersAsAdmin = () => 922 | let 923 | source = PowerBIRESTAPI.DatasetsAsAdmin(), 924 | trimColumns = Table.SelectColumns(source,{"Dataset ID"}), 925 | addColumn = Table.AddColumn(trimColumns, "Users", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/datasets/" & Text.From([Dataset ID])&"/users"))[value],{"emailAddress","datasetUserAccessRight","displayName","identifier","principalType","graphId"},MissingField.UseNull ) otherwise null ), 926 | expand = Table.ExpandTableColumn(addColumn, "Users", {"emailAddress", "datasetUserAccessRight", "displayName", "identifier", "principalType", "graphId"}, {"Email Address", "User Access Level", "Display Name", "Identifier", "Principal Type", "Graph ID"}), 927 | changeType = Table.TransformColumnTypes(expand,{{"Email Address", type text}, {"User Access Level", type text}, {"Display Name", type text}, {"Identifier", type text}, {"Principal Type", type text}, {"Graph ID", type text}}) 928 | in 929 | changeType; 930 | 931 | 932 | [DataSource.Kind="PowerBIRESTAPI"] 933 | PowerBIRESTAPI.DataflowUsersAsAdmin = () => 934 | let 935 | source = PowerBIRESTAPI.DataflowsAsAdmin(), 936 | trimColumns = Table.SelectColumns(source,{"Dataflow ID"}), 937 | addColumn = Table.AddColumn(trimColumns, "Users", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/dataflows/" & Text.From([Dataflow ID])&"/users"))[value],{"emailAddress","dataflowUserAccessRight","displayName","identifier","principalType","graphId"},MissingField.UseNull ) otherwise null ), 938 | expand = Table.ExpandTableColumn(addColumn, "Users", {"emailAddress", "dataflowUserAccessRight", "displayName", "identifier", "principalType", "graphId"}, {"Email Address", "User Access Level", "Display Name", "Identifier", "Principal Type", "Graph ID"}), 939 | changeType = Table.TransformColumnTypes(expand,{{"Email Address", type text}, {"User Access Level", type text}, {"Display Name", type text}, {"Identifier", type text}, {"Principal Type", type text}, {"Graph ID", type text}}) 940 | in 941 | changeType; 942 | 943 | 944 | [DataSource.Kind="PowerBIRESTAPI"] 945 | PowerBIRESTAPI.DashboardUsersAsAdmin = () => 946 | let 947 | source = PowerBIRESTAPI.DashboardsAsAdmin(), 948 | trimColumns = Table.SelectColumns(source,{"Dashboard ID"}), 949 | addColumn = Table.AddColumn(trimColumns, "Users", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/dashboards/" & Text.From([Dashboard ID])&"/users"))[value],{"emailAddress","dashboardUserAccessRight","displayName","identifier","principalType","graphId"},MissingField.UseNull ) otherwise null ), 950 | expand = Table.ExpandTableColumn(addColumn, "Users", {"emailAddress", "dashboardUserAccessRight", "displayName", "identifier", "principalType", "graphId"}, {"Email Address", "User Access Level", "Display Name", "Identifier", "Principal Type", "Graph ID"}), 951 | changeType = Table.TransformColumnTypes(expand,{{"Email Address", type text}, {"User Access Level", type text}, {"Display Name", type text}, {"Identifier", type text}, {"Principal Type", type text}, {"Graph ID", type text}}) 952 | in 953 | changeType; 954 | 955 | 956 | [DataSource.Kind="PowerBIRESTAPI"] 957 | PowerBIRESTAPI.DashboardSubscriptionsAsAdmin = () => 958 | let 959 | source = PowerBIRESTAPI.DashboardsAsAdmin(), 960 | trimColumns = Table.SelectColumns(source,{"Dashboard ID"}), 961 | subscriptions = Table.AddColumn(trimColumns, "Subscriptions", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/dashboards/" & Text.From([Dashboard ID])&"/subscriptions") )[value],{"id", "title", "artifactId", "artifactDisplayName", "artifactType", "isEnabled", "frequency", "startDate", "endDate", "linkToContent", "previewImage", "users"},MissingField.UseNull) otherwise null ), 962 | trimColumns2 = Table.SelectColumns(subscriptions,{"Subscriptions"}), 963 | expandSubscriptions = Table.ExpandTableColumn(trimColumns2, "Subscriptions", {"id", "title", "artifactId", "artifactDisplayName", "artifactType", "isEnabled", "frequency", "startDate", "endDate", "linkToContent", "previewImage", "users"}, {"Subscription ID", "Subscription Name", "Dashboard ID", "Dashboard Name", "Dashboard Type", "Is Enabled", "Frequency", "Start Date", "End Date", "Link To Content", "Preview Image", "Users"}), 964 | filterNoSubscriptions = Table.SelectRows(expandSubscriptions, each [Subscription ID] <> null and [Subscription ID] <> ""), 965 | parsedDate = Table.TransformColumns(filterNoSubscriptions,{{"End Date", each Date.From(DateTimeZone.From(_)), type date}, {"Start Date", each Date.From(DateTimeZone.From(_)), type date}}), 966 | changedType = Table.TransformColumnTypes(parsedDate,{{"Link To Content", type logical}, {"Preview Image", type logical}, {"Is Enabled", type logical}}) 967 | in 968 | changedType; 969 | 970 | 971 | [DataSource.Kind="PowerBIRESTAPI"] 972 | PowerBIRESTAPI.DashboardsAsAdmin = () => 973 | let 974 | source = PowerBIRESTAPI.GroupsAsAdmin(), 975 | trimColumns = Table.SelectColumns(source,{"Workspace ID", "dashboards"}), 976 | convertToRecords = Table.ExpandListColumn(trimColumns, "dashboards"), 977 | expandRecords = Table.ExpandRecordColumn(convertToRecords, "dashboards", {"id", "displayName", "isReadOnly", "appId"}, {"Dashboard ID", "Dashboard Name", "Is Read Only", "App ID"}), 978 | filterNoDashboards = Table.SelectRows(expandRecords, each ([Dashboard ID] <> null)), 979 | changeType = Table.TransformColumnTypes(filterNoDashboards,{{"Dashboard ID", type text}, {"Dashboard Name", type text}, {"Is Read Only", type logical}, {"App ID", type text}}) 980 | in 981 | changeType; 982 | 983 | [DataSource.Kind="PowerBIRESTAPI"] 984 | PowerBIRESTAPI.DatasetsAsAdmin = () => 985 | let 986 | source = PowerBIRESTAPI.GroupsAsAdmin(), 987 | trimColumns = Table.SelectColumns(source,{"Workspace ID", "datasets"}), 988 | convertToRecords = Table.ExpandListColumn(trimColumns, "datasets"), 989 | expandRecords = Table.ExpandRecordColumn(convertToRecords, "datasets", {"id", "name", "addRowsAPIEnabled", "configuredBy", "isRefreshable", "isEffectiveIdentityRequired", "isEffectiveIdentityRolesRequired", "isOnPremGatewayRequired", "targetStorageMode"}, {"Dataset ID", "Dataset Name", "Is Add Rows API Enabled", "Dataset Configured By", "Is Refreshable", "Is Effective Identity Required", "Is Effective Identity Roles Required", "Is On Prem Gateway Required", "Target Storage Mode"}), 990 | filterNoDatasets = Table.SelectRows(expandRecords, each ([Dataset ID] <> null)), 991 | changeType = Table.TransformColumnTypes(filterNoDatasets,{{"Dataset ID", type text}, {"Dataset Name", type text}, {"Is Add Rows API Enabled", type logical}, {"Dataset Configured By", type text}, {"Is Refreshable", type logical}, {"Is Effective Identity Required", type logical}, {"Is Effective Identity Roles Required", type logical}, {"Is On Prem Gateway Required", type logical}, {"Target Storage Mode", type text}}) 992 | in 993 | changeType; 994 | 995 | [DataSource.Kind="PowerBIRESTAPI"] 996 | PowerBIRESTAPI.DataflowsAsAdmin = () => 997 | let 998 | source = PowerBIRESTAPI.GroupsAsAdmin(), 999 | trimColumns = Table.SelectColumns(source,{"Workspace ID", "dataflows"}), 1000 | convertToRecords = Table.ExpandListColumn(trimColumns, "dataflows"), 1001 | expandRecords = Table.ExpandRecordColumn(convertToRecords, "dataflows", {"objectId", "name", "description", "configuredBy"}, {"Dataflow ID", "Dataflow Name", "Dataflow Description", "Dataflow Configured By"}), 1002 | filterNoDataflows = Table.SelectRows(expandRecords, each ([Dataflow ID] <> null)), 1003 | changeType = Table.TransformColumnTypes(filterNoDataflows,{{"Dataflow ID", type text}, {"Dataflow Name", type text}, {"Dataflow Description", type text}, {"Dataflow Configured By", type text}}) 1004 | in 1005 | changeType; 1006 | 1007 | [DataSource.Kind="PowerBIRESTAPI"] 1008 | PowerBIRESTAPI.CapacitiesAsAdmin = () => 1009 | let 1010 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/admin/capacities"))[value], 1011 | convertToTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 1012 | expandRecords = Table.ExpandRecordColumn(convertToTable, "Column1", {"id", "displayName", "sku", "state", "region"}, {"Capacity ID", "Capacity Name", "Capacity SKU", "Capacity State", "Capacity Region"}), 1013 | changeType = Table.TransformColumnTypes(expandRecords,{{"Capacity ID", type text}, {"Capacity Name", type text}, {"Capacity SKU", type text}, {"Capacity State", type text}, {"Capacity Region", type text}}) 1014 | in 1015 | changeType; 1016 | 1017 | [DataSource.Kind="PowerBIRESTAPI"] 1018 | PowerBIRESTAPI.CapacityRefreshablesAsAdmin = () => 1019 | let 1020 | source = PowerBIRESTAPI.CapacitiesAsAdmin(), 1021 | trimColumns = Table.SelectColumns(source,{"Capacity ID"}), 1022 | apiCall = Table.AddColumn(trimColumns, "Capacity Refreshables", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/admin/capacities/" & Text.From([Capacity ID])&"/refreshables?$expand=group"))[value],{"id", "name", "kind", "lastRefresh", "refreshSchedule", "configuredBy", "group"},MissingField.UseNull) otherwise null ), 1023 | expandCapacityRefreshables = Table.ExpandTableColumn(apiCall, "Capacity Refreshables", {"id", "name", "kind", "lastRefresh", "refreshSchedule", "configuredBy", "group"}, {"Capacity Refreshable ID", "Capacity Refreshable Name", "Capacity Refreshable Kind", "lastRefresh", "refreshSchedule", "configuredBy", "group"}), 1024 | filterNoRefreshables = Table.SelectRows(expandCapacityRefreshables, each ([Capacity Refreshable ID] <> null)), 1025 | expandRefreshSchedule = Table.ExpandRecordColumn(filterNoRefreshables, "refreshSchedule", {"days", "times", "enabled", "localTimeZoneId", "notifyOption"}, {"Refresh Schedule Days", "Refresh Schedule Times", "Refresh Enabled", "Time Zone", "Notify Option"}), 1026 | extractedDays = Table.TransformColumns(expandRefreshSchedule, {"Refresh Schedule Days", each Text.Combine(List.Transform(_, Text.From), ","), type text}), 1027 | replaceEveryday = Table.ReplaceValue(extractedDays,"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday","Everyday",Replacer.ReplaceText,{"Refresh Schedule Days"}), 1028 | replacedWeekday = Table.ReplaceValue(replaceEveryday,"Monday,Tuesday,Wednesday,Thursday,Friday","Every Weekday",Replacer.ReplaceText,{"Refresh Schedule Days"}), 1029 | extractedTimes = Table.TransformColumns(replacedWeekday, {"Refresh Schedule Times", each Text.Combine(List.Transform(_, Text.From), ","), type text}), 1030 | expandConfiguredBy = Table.ExpandListColumn(extractedTimes, "configuredBy"), 1031 | expandGroup = Table.ExpandRecordColumn(expandConfiguredBy, "group", {"id"}, {"Workspace ID"}), 1032 | expandLastRefresh = Table.ExpandRecordColumn(expandGroup, "lastRefresh", {"id", "refreshType", "startTime", "endTime", "serviceExceptionJson", "status", "requestId"}, {"Last Refresh ID", "Last Refresh Type", "Last Refresh Start Time", "Last Refresh End Time", "serviceExceptionJson", "Last Refresh Status", "Last Refresh Request ID"}), 1033 | #"Parsed JSON" = Table.TransformColumns(expandLastRefresh,{{"serviceExceptionJson", Json.Document}}), 1034 | #"Replaced Errors" = Table.ReplaceErrorValues(#"Parsed JSON", {{"serviceExceptionJson", null}}), 1035 | #"Expanded serviceExceptionJson" = Table.ExpandRecordColumn(#"Replaced Errors", "serviceExceptionJson", {"error"}, {"error"}), 1036 | #"Expanded error" = Table.ExpandRecordColumn(#"Expanded serviceExceptionJson", "error", {"code", "pbi.error"}, {"Last Refresh Error Code", "pbi.error"}), 1037 | #"Expanded pbi.error" = Table.ExpandRecordColumn(#"Expanded error", "pbi.error", {"details"}, {"details"}), 1038 | #"Expanded details2" = Table.ExpandListColumn(#"Expanded pbi.error", "details"), 1039 | #"Expanded details1" = Table.ExpandRecordColumn(#"Expanded details2", "details", {"code", "detail"}, {"Last Refresh Error Label", "detail"}), 1040 | #"Filtered Rows" = Table.SelectRows(#"Expanded details1", each ([Last Refresh Error Label] <> "ActivityIdText" and [Last Refresh Error Label] <> "ClusterUriText" and [Last Refresh Error Label] <> "RequestIdText" and [Last Refresh Error Label] <> "TimestampText")), 1041 | #"Expanded detail" = Table.ExpandRecordColumn(#"Filtered Rows", "detail", {"value"}, {"Last Refresh Error Value"}), 1042 | #"Changed Type" = Table.TransformColumnTypes(#"Expanded detail",{{"Capacity Refreshable ID", type text}, {"Capacity Refreshable Name", type text}, {"Capacity Refreshable Kind", type text}, {"Last Refresh Type", type text}, {"Last Refresh Status", type text}, {"Last Refresh Request ID", type text}, {"Refresh Schedule Days", type text}, {"Refresh Schedule Times", type text}, {"Time Zone", type text}, {"Notify Option", type text}, {"configuredBy", type text}, {"Workspace ID", type text}, {"Last Refresh ID", Int64.Type}, {"Last Refresh Start Time", type datetimezone}, {"Last Refresh End Time", type datetimezone}, {"Last Refresh Error Code", type text}, {"Last Refresh Error Label", type text}, {"Last Refresh Error Value", type text}, {"Refresh Enabled", type text}}), 1043 | #"Replaced Value" = Table.ReplaceValue(#"Changed Type","false","No",Replacer.ReplaceText,{"Refresh Enabled"}), 1044 | #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","true","Yes",Replacer.ReplaceText,{"Refresh Enabled"}) 1045 | in 1046 | #"Replaced Value1"; 1047 | 1048 | [DataSource.Kind="PowerBIRESTAPI"] 1049 | PowerBIRESTAPI.DatasetDatasourcesAsAdmin = () => 1050 | let 1051 | source = PowerBIRESTAPI.DatasetsAsAdmin(), 1052 | trimColumns = Table.SelectColumns(source,{"Dataset ID"}), 1053 | datasources = Table.AddColumn(trimColumns, "datasources", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/datasets/" & Text.From([Dataset ID])&"/datasources") )[value],{"datasourceType", "connectionDetails", "datasourceId", "gatewayId"},MissingField.UseNull) otherwise null ), 1054 | expandDatasources = Table.ExpandTableColumn(datasources, "datasources", {"datasourceType", "connectionDetails", "datasourceId", "gatewayId"}, {"Datasource Type", "connectionDetails", "Datasource ID", "Gateway ID"}), 1055 | filterNoRefreshables = Table.SelectRows(expandDatasources, each ([Datasource ID] <> null)), 1056 | expandConnectionDetails = Table.ExpandRecordColumn(filterNoRefreshables, "connectionDetails", {"path", "kind", "connectionString", "extensionDataSourceKind", "extensionDataSourcePath", "account", "domain", "server", "database", "sharePointSiteUrl", "url"}, {"path", "kind", "connectionString", "extensionDataSourceKind", "extensionDataSourcePath", "account", "domain", "server", "database", "sharePointSiteUrl", "url"}), 1057 | ServerAndDB = Table.AddColumn(expandConnectionDetails,"Server And Database", each [server]&" | "&[database]), 1058 | ExtensionFull = Table.AddColumn(ServerAndDB, "ExtensionFull", each [kind] & " | " & [path]), 1059 | ConnectionInfo = Table.AddColumn(ExtensionFull, "Connection Information", each if [Datasource Type] = "AnalysisServices" then [Server And Database] 1060 | else if [Datasource Type] = "ODBC" then [connectionString] else if [Datasource Type] = "Sql" then [Server And Database] 1061 | else if [Datasource Type] = "File" then [path] 1062 | else if [Datasource Type] = "ActiveDirectory" then [domain] 1063 | else if [Datasource Type] = "Folder" then [path] 1064 | else if [Datasource Type] = "Web" then [url] 1065 | else if [Datasource Type] = "MySql" then [Server And Database] 1066 | else if [Datasource Type] = "DB2" then [Server And Database] 1067 | else if [Datasource Type] = "OData" then [url] 1068 | else if [Datasource Type] = "SharePointList" then [url] 1069 | else if [Datasource Type] = "Extension" then [ExtensionFull] 1070 | else if [Datasource Type] = "Teradata" then [server] 1071 | else if [Datasource Type] = "Oracle" then [server] 1072 | else if [Datasource Type] = "Exchange" then [emailAddress] 1073 | else if [Datasource Type] = "OleDb" then [connectionString] 1074 | else if [Datasource Type] = "AzureBlobs" then [account]&" | "&[domain] 1075 | else "Requires Mapping"), 1076 | removeColumns = Table.SelectColumns(ConnectionInfo,{"Dataset ID", "Datasource ID", "Gateway ID", "Connection Information", "Datasource Type"}), 1077 | changeType = Table.TransformColumnTypes(removeColumns,{{"Datasource ID", type text}, {"Gateway ID", type text}, {"Connection Information", type text}, {"Datasource Type", type text}}) 1078 | in 1079 | changeType; 1080 | 1081 | [DataSource.Kind="PowerBIRESTAPI"] 1082 | PowerBIRESTAPI.DataflowDatasourcesAsAdmin = () => 1083 | let 1084 | source = PowerBIRESTAPI.DataflowsAsAdmin(), 1085 | trimColumns = Table.SelectColumns(source,{"Dataflow ID"}), 1086 | datasources = Table.AddColumn(trimColumns, "datasources", each try Table.FromRecords(Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/admin/dataflows/" & Text.From([Dataflow ID])&"/datasources"))[value],{"datasourceType", "connectionDetails", "datasourceId", "gatewayId"},MissingField.UseNull) otherwise null ), 1087 | expandDatasources = Table.ExpandTableColumn(datasources, "datasources", {"datasourceType", "connectionDetails", "datasourceId", "gatewayId"}, {"Datasource Type", "connectionDetails", "Datasource ID", "Gateway ID"}), 1088 | filterNoRefreshables = Table.SelectRows(expandDatasources, each ([Datasource ID] <> null)), 1089 | expandConnectionDetails = Table.ExpandRecordColumn(filterNoRefreshables, "connectionDetails", {"path", "connectionString", "extensionDataSourceKind", "extensionDataSourcePath", "account", "domain", "server", "database", "sharePointSiteUrl", "url"}, {"path", "connectionString", "extensionDataSourceKind", "extensionDataSourcePath", "account", "domain", "server", "database", "sharePointSiteUrl", "url"}), 1090 | ServerAndDB = Table.AddColumn(expandConnectionDetails,"Server And Database", each [server]&" | "&[database]), 1091 | ExtensionFull = Table.AddColumn(ServerAndDB, "ExtensionFull", each [extensionDataSourceKind] & " | " & [extensionDataSourcePath]), 1092 | ConnectionInfo = Table.AddColumn(ExtensionFull, "Connection Information", each if [Datasource Type] = "AnalysisServices" then [Server And Database] 1093 | else if [Datasource Type] = "ODBC" then [connectionString] 1094 | else if [Datasource Type] = "Sql" then [Server And Database] 1095 | else if [Datasource Type] = "File" then [path] 1096 | else if [Datasource Type] = "ActiveDirectory" then [domain] 1097 | else if [Datasource Type] = "Folder" then [path] 1098 | else if [Datasource Type] = "Web" then [url] 1099 | else if [Datasource Type] = "MySql" then [Server And Database] 1100 | else if [Datasource Type] = "DB2" then [Server And Database] 1101 | else if [Datasource Type] = "OData" then [url] 1102 | else if [Datasource Type] = "SharePointList" then [sharePointSiteUrl] 1103 | else if [Datasource Type] = "Extension" then [ExtensionFull] 1104 | else if [Datasource Type] = "Teradata" then [server] 1105 | else if [Datasource Type] = "Oracle" then [server] 1106 | else if [Datasource Type] = "Exchange" then [emailAddress] 1107 | else if [Datasource Type] = "OleDb" then [connectionString] 1108 | else if [Datasource Type] = "AzureBlobs" then [account]&" | "&[domain] 1109 | else "Requires Mapping"), 1110 | removeColumns = Table.SelectColumns(ConnectionInfo,{"Dataflow ID", "Datasource ID", "Gateway ID", "Connection Information", "Datasource Type"}), 1111 | changeType = Table.TransformColumnTypes(removeColumns,{{"Datasource ID", type text}, {"Gateway ID", type text}, {"Connection Information", type text}, {"Datasource Type", type text}}) 1112 | in 1113 | changeType; 1114 | 1115 | [DataSource.Kind="PowerBIRESTAPI"] 1116 | PowerBIRESTAPI.AppUsersAsAdmin = () => 1117 | let 1118 | source = PowerBIRESTAPI.AppsAsAdmin(), 1119 | trimColumns = Table.SelectColumns(source,{"App ID"}), 1120 | appUsers = Table.AddColumn(trimColumns, "appUsers", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/admin/apps/" & Text.From([App ID])&"/users") )[value],{"emailAddress", "appUserAccessRight", "identifier", "principalType", "graphId", "displayName"},MissingField.UseNull) otherwise null ), 1121 | expandUsers = Table.ExpandTableColumn(appUsers, "appUsers", {"emailAddress", "appUserAccessRight", "identifier", "principalType", "graphId", "displayName"}, {"Email Address", "App User Access Right", "Identifier", "Principal Type", "Graph ID", "Display Name"}), 1122 | #"Changed Type" = Table.TransformColumnTypes(expandUsers,{{"Email Address", type text}, {"App User Access Right", type text}, {"Identifier", type text}, {"Principal Type", type text}, {"Graph ID", type text}, {"Display Name", type text}}) 1123 | in 1124 | #"Changed Type"; 1125 | 1126 | [DataSource.Kind="PowerBIRESTAPI"] 1127 | PowerBIRESTAPI.AppsAsAdmin = () => 1128 | let 1129 | BaseUrl = "https://api.powerbi.com/v1.0/myorg/admin/Apps?", 1130 | EntitiesPerPage = 5000, 1131 | 1132 | GetJson = (Url) => 1133 | let RawData = Web.Contents(Url), 1134 | Json = Json.Document(RawData) 1135 | in 1136 | Json, 1137 | 1138 | GetEntityCount = () => 1139 | let Url = "https://api.powerbi.com/v1.0/myorg/admin/Groups?$top=1", 1140 | Json = GetJson(Url), 1141 | Count = Json[#"@odata.count"] 1142 | in 1143 | Count, 1144 | 1145 | GetPage = (Index) => 1146 | let Skip = "$skip=" & Text.From(Index * EntitiesPerPage), 1147 | Top = "$top=" & Text.From(EntitiesPerPage), 1148 | Url = BaseUrl & "&" & Skip & "&" & Top, 1149 | Json = GetJson(Url), 1150 | Value = Json[#"value"] 1151 | in 1152 | Value, 1153 | 1154 | EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }), 1155 | PageCount = Number.RoundUp(EntityCount / EntitiesPerPage), 1156 | PageIndices = { 0 .. PageCount - 1 }, 1157 | Pages = List.Transform(PageIndices, each GetPage(_)), 1158 | Entities = List.Union(Pages), 1159 | Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 1160 | expandColumns = Table.ExpandRecordColumn(Table, "Column1", {"id", "name", "description", "publishedBy", "lastUpdate"}, {"App ID", "App Name", "App Description", "Published By", "Last Updated"}), 1161 | #"Changed Type" = Table.TransformColumnTypes(expandColumns,{{"App ID", type text}, {"App Name", type text}, {"App Description", type text}, {"Published By", type text}, {"Last Updated", type datetime}}) 1162 | in 1163 | #"Changed Type"; 1164 | 1165 | [DataSource.Kind="PowerBIRESTAPI"] 1166 | PowerBIRESTAPI.PipelinesAsAdmin = () => 1167 | let 1168 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/admin/pipelines?$expand=users,stages"))[value], 1169 | toTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 1170 | expand = Table.ExpandRecordColumn(toTable, "Column1", {"id", "displayName", "users", "stages", "description"}, {"id", "displayName", "users", "stages", "description"}), 1171 | removeColumns = Table.SelectColumns(expand,{"id", "displayName", "description"}), 1172 | renameColumns = Table.RenameColumns(removeColumns,{{"id", "Pipeline ID"}, {"displayName", "Pipeline Name"}, {"description", "Pipeline Description"}}), 1173 | changeType = Table.TransformColumnTypes(renameColumns,{{"Pipeline Description", type text}, {"Pipeline Name", type text}, {"Pipeline ID", type text}}) 1174 | in 1175 | changeType; 1176 | 1177 | [DataSource.Kind="PowerBIRESTAPI"] 1178 | PowerBIRESTAPI.PipelineUsersAsAdmin = () => 1179 | let 1180 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/admin/pipelines?$expand=users"))[value], 1181 | toTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 1182 | expandColumns = Table.ExpandRecordColumn(toTable, "Column1", {"id", "users"}, {"id", "users"}), 1183 | expandList = Table.ExpandListColumn(expandColumns, "users"), 1184 | expandRecords = Table.ExpandRecordColumn(expandList, "users", {"accessRight", "identifier", "principalType"}, {"accessRight", "identifier", "principalType"}), 1185 | renameColumns = Table.RenameColumns(expandRecords,{{"id", "Pipeline ID"}, {"accessRight", "Access Level"}, {"identifier", "Identifier"}, {"principalType", "Principal Type"}}), 1186 | changeType = Table.TransformColumnTypes(renameColumns,{{"Principal Type", type text}, {"Identifier", type text}, {"Access Level", type text}, {"Pipeline ID", type text}}) 1187 | in 1188 | changeType; 1189 | 1190 | [DataSource.Kind="PowerBIRESTAPI"] 1191 | PowerBIRESTAPI.PipelineStagesAsAdmin = () => 1192 | let 1193 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/admin/pipelines?$expand=stages"))[value], 1194 | toTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 1195 | expandColumns = Table.ExpandRecordColumn(toTable, "Column1", {"id", "stages"}, {"id", "stages"}), 1196 | expandList = Table.ExpandListColumn(expandColumns, "stages"), 1197 | expandRecords = Table.ExpandRecordColumn(expandList, "stages", {"order", "workspaceId", "workspaceName"}, {"order", "workspaceId", "workspaceName"}), 1198 | changeType = Table.TransformColumnTypes(expandRecords,{{"id", type text}, {"workspaceId", type text}, {"workspaceName", type text}, {"order", Int64.Type}}), 1199 | renameColumns = Table.RenameColumns(changeType,{{"id", "Pipeline ID"}, {"order", "Stage Order"}, {"workspaceId", "Workspace ID"}, {"workspaceName", "Workspace Name"}}) 1200 | in 1201 | renameColumns; 1202 | 1203 | [DataSource.Kind="PowerBIRESTAPI"] 1204 | PowerBIRESTAPI.GroupsPipelines = () => 1205 | let 1206 | source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/pipelines?$expand=users,stages"))[value], 1207 | toTable = Table.FromList(source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), 1208 | expand = Table.ExpandRecordColumn(toTable, "Column1", {"id", "displayName", "users", "stages", "description"}, {"id", "displayName", "users", "stages", "description"}), 1209 | removeColumns = Table.SelectColumns(expand,{"id", "displayName", "description"}), 1210 | renameColumns = Table.RenameColumns(removeColumns,{{"id", "Pipeline ID"}, {"displayName", "Pipeline Name"}, {"description", "Pipeline Description"}}), 1211 | changeType = Table.TransformColumnTypes(renameColumns,{{"Pipeline Description", type text}, {"Pipeline Name", type text}, {"Pipeline ID", type text}}) 1212 | in 1213 | changeType; 1214 | 1215 | [DataSource.Kind="PowerBIRESTAPI"] 1216 | PowerBIRESTAPI.GroupsPipelineUsers = () => 1217 | let 1218 | source = PowerBIRESTAPI.GroupsPipelines(), 1219 | trimColumns = Table.SelectColumns(source,{"Pipeline ID"}), 1220 | webCall = Table.AddColumn(trimColumns, "Column1", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/pipelines/" & Text.From([Pipeline ID])&"/users") )[value],{"identifier", "accessRight", "principalType"},MissingField.UseNull) otherwise null ), 1221 | expandColumn = Table.ExpandTableColumn(webCall, "Column1", {"identifier", "accessRight", "principalType"}, {"identifier", "accessRight", "principalType"}), 1222 | changeType = Table.TransformColumnTypes(expandColumn,{{"identifier", type text}, {"accessRight", type text}, {"principalType", type text}}), 1223 | renameColumns = Table.RenameColumns(changeType,{{"identifier", "Identifier"}, {"accessRight", "Access Right"}, {"principalType", "Principal Type"}}) 1224 | in 1225 | renameColumns; 1226 | 1227 | [DataSource.Kind="PowerBIRESTAPI"] 1228 | PowerBIRESTAPI.GroupsPipelineOperations = () => 1229 | let 1230 | source = PowerBIRESTAPI.GroupsPipelines(), 1231 | trimColumns = Table.SelectColumns(source,{"Pipeline ID"}), 1232 | webCall = Table.AddColumn(trimColumns, "Column1", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/pipelines/" & Text.From([Pipeline ID])&"/operations") )[value],{"id", "type", "status","lastUpdatedTime","executionStartTime","executionEndTime","sourceStageOrder","targetStageOrder"},MissingField.UseNull) otherwise null ), 1233 | expandColumn = Table.ExpandTableColumn(webCall, "Column1", {"id", "type", "status", "lastUpdatedTime", "executionStartTime", "executionEndTime", "sourceStageOrder", "targetStageOrder"}, {"id", "type", "status", "lastUpdatedTime", "executionStartTime", "executionEndTime", "sourceStageOrder", "targetStageOrder"}), 1234 | changeType = Table.TransformColumnTypes(expandColumn,{{"id", type text}, {"type", type text}, {"status", type text}, {"lastUpdatedTime", type datetimezone}, {"executionStartTime", type datetimezone}, {"executionEndTime", type datetimezone}, {"sourceStageOrder", Int64.Type}, {"targetStageOrder", Int64.Type}}), 1235 | renameColumns = Table.RenameColumns(changeType,{{"id", "Operation ID"}, {"type", "Type"}, {"status", "Status"}, {"lastUpdatedTime", "Last Updated Datetime"}, {"executionStartTime", "Execution Start Datetime"}, {"executionEndTime", "Execution End Datetime"}, {"sourceStageOrder", "Source Stage Order"}, {"targetStageOrder", "Target Stage Order"}}) 1236 | in 1237 | renameColumns; 1238 | 1239 | [DataSource.Kind="PowerBIRESTAPI"] 1240 | PowerBIRESTAPI.GroupsPipelineStages = () => 1241 | let 1242 | source = PowerBIRESTAPI.GroupsPipelines(), 1243 | trimColumns = Table.SelectColumns(source,{"Pipeline ID"}), 1244 | webCall = Table.AddColumn(trimColumns, "Column1", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/pipelines/" & Text.From([Pipeline ID])&"/stages") )[value],{"order", "workspaceId", "workspaceName"},MissingField.UseNull) otherwise null ), 1245 | expandColumn = Table.ExpandTableColumn(webCall, "Column1", {"order", "workspaceId", "workspaceName"}, {"order", "workspaceId", "workspaceName"}), 1246 | changeType = Table.TransformColumnTypes(expandColumn,{{"workspaceId", type text}, {"workspaceName", type text}, {"order", Int64.Type}}), 1247 | renameColumns = Table.RenameColumns(changeType,{{"order", "Stage Order"}, {"workspaceId", "Workspace ID"}, {"workspaceName", "Workspace Name"}}), 1248 | typeOfStage = Table.AddColumn(renameColumns,"Name of Stage",each if [#"Stage Order"] = 0 then "Development" else if [#"Stage Order"] = 1 then "Test" else "Production", type text) 1249 | in 1250 | typeOfStage; 1251 | 1252 | [DataSource.Kind="PowerBIRESTAPI"] 1253 | PowerBIRESTAPI.GroupsPipelineStageArtifacts = () => 1254 | let 1255 | source = PowerBIRESTAPI.GroupsPipelineStages(), 1256 | trimColumns = Table.SelectColumns(source,{"Pipeline ID","Stage Order"}), 1257 | changeType = Table.TransformColumnTypes(trimColumns,{{"Stage Order", type text}}), 1258 | webCall = Table.AddColumn(changeType, "Column1", each try Table.FromRecords(Json.Document(Web.Contents( "https://api.powerbi.com/v1.0/myorg/pipelines/" & Text.From([Pipeline ID])&"/stages/"& Text.From([Stage Order])&"/artifacts") )[value] ) otherwise null ) 1259 | in 1260 | webCall; 1261 | 1262 | [ 1263 | DataSource.Kind = "PowerBIRESTAPI" 1264 | ] 1265 | shared PowerBIRESTAPI.Scorecards = 1266 | Value.ReplaceType( 1267 | Scorecards, 1268 | ScorecardsType 1269 | ); 1270 | 1271 | ScorecardsType = 1272 | type function (optional workspaceId as 1273 | ( 1274 | type text 1275 | meta 1276 | [ 1277 | Documentation.FieldCaption = "Workspace ID", 1278 | Documentation.FieldDescription = "Workspace ID from where you want return the Scorecards", 1279 | Documentation.SampleValues = { 1280 | "xxx-xxxx-yyxa..." 1281 | } 1282 | ] 1283 | )) as table 1284 | meta 1285 | [ 1286 | Documentation.Name = "PowerBIRESTAPI.Scorecards", 1287 | Documentation.LongDescription = 1288 | "!!! This call can be used only on Groups where you have access !!! 1289 | Returns all Scorecards that are in selected workspace", 1290 | Documentation.Examples = { 1291 | [ 1292 | Code = "=PowerBIRESTAPI.Scorecards(""xxx-xxxx-yyxa..."")", 1293 | Result = "" 1294 | ] 1295 | } 1296 | ]; 1297 | 1298 | Scorecards = 1299 | (optional workspaceId as text) => 1300 | let 1301 | functionVarTester = 1302 | if 1303 | workspaceId 1304 | <> null and workspaceId 1305 | <> "" 1306 | then 1307 | let 1308 | apiCall = 1309 | Json.Document( 1310 | Web.Contents( 1311 | "https://api.powerbi.com/v1.0/myorg", 1312 | [ 1313 | RelativePath = "groups/" & workspaceId & "/scorecards", 1314 | Headers = [ 1315 | #"Content-Type" = "application/json" 1316 | ] 1317 | ] 1318 | ) 1319 | ), 1320 | output = 1321 | #table( 1322 | type table [ 1323 | id = text, 1324 | name = text, 1325 | contact = text, 1326 | lastModifiedBy = text, 1327 | createdTime = datetime, 1328 | lastModifiedTime = datetime, 1329 | provisioningStatus = text, 1330 | groupId = text, 1331 | datasetId = text, 1332 | reportId = text, 1333 | statuses = list, 1334 | permissions = text, 1335 | columnSettings = list 1336 | ], 1337 | List.Transform( 1338 | apiCall[value], 1339 | each 1340 | { 1341 | _[id]?, 1342 | _[name]?, 1343 | _[contact]?, 1344 | _[lastModifiedBy]?, 1345 | _[createdTime]?, 1346 | _[lastModifiedTime]?, 1347 | _[provisioningStatus]?, 1348 | _[groupId]?, 1349 | _[datasetId]?, 1350 | _[reportId]?, 1351 | _[statuses]?, 1352 | _[permissions]?, 1353 | _[columnSettings]? 1354 | } 1355 | ) 1356 | ) 1357 | in 1358 | output 1359 | else 1360 | #table( 1361 | type table [Response = text], 1362 | { 1363 | { 1364 | "Please fill parameter of function." 1365 | } 1366 | } 1367 | ) 1368 | in 1369 | functionVarTester; 1370 | 1371 | //**** Goals 1372 | [ 1373 | DataSource.Kind = "PowerBIRESTAPI" 1374 | ] 1375 | shared PowerBIRESTAPI.Goals = Value.ReplaceType(Goals, GoalsType); 1376 | 1377 | GoalsType = 1378 | type function (optional workspaceId as 1379 | ( 1380 | type text 1381 | meta 1382 | [ 1383 | Documentation.FieldCaption = "Workspace ID", 1384 | Documentation.FieldDescription = "Workspace ID where is scorecard stored.", 1385 | Documentation.SampleValues = { 1386 | "xxx-xxxx-yyxa..." 1387 | } 1388 | ] 1389 | ), optional scorecardId as 1390 | ( 1391 | type text 1392 | meta 1393 | [ 1394 | Documentation.FieldCaption = "Scorecard ID", 1395 | Documentation.FieldDescription = "Scorecard ID from where you want to recieve goals.", 1396 | Documentation.SampleValues = { 1397 | "xxx-xxxx-yyxa..." 1398 | } 1399 | ] 1400 | )) as table 1401 | meta 1402 | [ 1403 | Documentation.Name = "PowerBIRESTAPI.Goals", 1404 | Documentation.LongDescription = 1405 | "!!! This call can be used only on Groups where you have access !!! 1406 | Returns all Goals that are from selected scorecard and in selected workspace.", 1407 | Documentation.Examples = { 1408 | [ 1409 | Code = "=PowerBIRESTAPI.Goals(""xxx-xxxx-yyxa..."",""xxx-xxxx-yyxa..."")", 1410 | Result = "" 1411 | ] 1412 | } 1413 | ]; 1414 | 1415 | Goals = 1416 | (optional workspaceId as text, optional scorecardId as text) => 1417 | let 1418 | functionVarTester = 1419 | try 1420 | if 1421 | ( 1422 | workspaceId 1423 | <> null and workspaceId 1424 | <> "" 1425 | ) and ( 1426 | scorecardId 1427 | <> null and scorecardId 1428 | <> "" 1429 | ) 1430 | then 1431 | let 1432 | apiCall = 1433 | Json.Document( 1434 | Web.Contents( 1435 | "https://api.powerbi.com/v1.0/myorg", 1436 | [ 1437 | RelativePath = 1438 | "groups/" 1439 | & workspaceId 1440 | & "/scorecards/" 1441 | & scorecardId 1442 | & "/goals", 1443 | Headers = [ 1444 | #"Content-Type" = "application/json" 1445 | ] 1446 | ] 1447 | ) 1448 | ), 1449 | output = 1450 | #table( 1451 | type table [ 1452 | id = text, 1453 | name = text, 1454 | scorecardId = text, 1455 | lastModifiedBy = text, 1456 | createdTime = datetime, 1457 | owner = text, 1458 | unit = text, 1459 | lastModifiedTime = datetime, 1460 | startDate = datetime, 1461 | completionDate = datetime, 1462 | valueConnection = record, 1463 | notesCount = text, 1464 | valuesFormatString = text, 1465 | permissions = text, 1466 | level = text, 1467 | rank = text, 1468 | additionalOwners = list 1469 | ], 1470 | List.Transform( 1471 | apiCall[value], 1472 | each 1473 | { 1474 | _[id]?, 1475 | _[name]?, 1476 | _[scorecardId]?, 1477 | _[lastModifiedBy]?, 1478 | _[createdTime]?, 1479 | _[owner]?, 1480 | _[unit]?, 1481 | _[lastModifiedTime]?, 1482 | _[startDate]?, 1483 | _[completionDate]?, 1484 | _[valueConnection]?, 1485 | _[notesCount]?, 1486 | _[valuesFormatString]?, 1487 | _[permissions]?, 1488 | _[level]?, 1489 | _[rank]?, 1490 | _[additionalOwners]? 1491 | } 1492 | ) 1493 | ) 1494 | in 1495 | output 1496 | else 1497 | #table( 1498 | type table [Response = text], 1499 | { 1500 | { 1501 | "Please fill parameters of function." 1502 | } 1503 | } 1504 | ) 1505 | otherwise 1506 | #table( 1507 | type table [Response = text], 1508 | { 1509 | { 1510 | "Hmm... Something is not quite right. Please check inserted parameters or try it later." 1511 | } 1512 | } 1513 | ) 1514 | in 1515 | functionVarTester; 1516 | 1517 | //**** Scanner API - GET INFO() 1518 | [DataSource.Kind = "PowerBIRESTAPI"] 1519 | shared PowerBIRESTAPI.ScannerAPIInfo = Value.ReplaceType(ScannerAPIInfo, ScannerAPIInfoType); 1520 | 1521 | ScannerAPIInfoType = type function ( 1522 | optional workspaceId as ( 1523 | type text meta [ 1524 | Documentation.FieldCaption = "Workspace ID", 1525 | Documentation.FieldDescription = "Workspace ID on what will scanning will be started.", 1526 | Documentation.SampleValues = {"xxx-xxxx-yyxa..."} 1527 | ] 1528 | ), 1529 | optional listWithWokspaceIds as ( 1530 | type list meta [ 1531 | Documentation.FieldCaption = "List with Workspace IDs", 1532 | Documentation.FieldDescription = "List of Workspace IDs on what will scanning will be started.", 1533 | Documentation.SampleValues = {"{xxx-xxxx-yyxa...,xxx-xxxx-yyxa...}"} 1534 | ] 1535 | ) 1536 | ) as table meta [ 1537 | Documentation.Name = "pbiAdminAPI.ScannerAPIInfo", 1538 | Documentation.LongDescription = "!!! This call only starts a scanning. For results of this scanning dont forget to call function for Results !!! 1539 | Returns ONLY and ONLY ""Id"" of scanning that is required for other calls.", 1540 | Documentation.Examples = {[Code = "=pbiAdminAPI.ScannerAPIInfo(""xxx-xxxx-yyxa..."")", Result = ""]} 1541 | ]; 1542 | 1543 | ScannerAPIInfo = (optional workspaceId as text, optional listWithWokspaceIds as list) => 1544 | let 1545 | functionVarTester = 1546 | if 1547 | (workspaceId <> null and workspaceId <> "") 1548 | or (listWithWokspaceIds <> null and listWithWokspaceIds <> {}) 1549 | then 1550 | let 1551 | apiCall = (wsId as text) => Json.Document( 1552 | Web.Contents( 1553 | "https://api.powerbi.com/v1.0/myorg/", 1554 | [ 1555 | RelativePath = "admin/workspaces/getInfo?lineage=True&datasourceDetails=True&datasetSchema=True&datasetExpressions=True&getArtifactUsers=True", 1556 | Headers = [#"Content-Type" = "application/json"], 1557 | Content = Text.ToBinary("{ ""workspaces"": [ " & wsId & "]}") 1558 | ] 1559 | ) 1560 | ), 1561 | ids = 1562 | if workspaceId = null then 1563 | let 1564 | split = List.Split(listWithWokspaceIds, 100), 1565 | transformator = List.Transform( 1566 | split, 1567 | each 1568 | let 1569 | insertedList = _, 1570 | idCreator = 1571 | """" 1572 | & List.Accumulate( 1573 | List.RemoveFirstN(insertedList, 1), 1574 | List.First(insertedList), 1575 | (state, current) => state & """,""" & current 1576 | ) 1577 | & """", 1578 | call = apiCall(idCreator) 1579 | in 1580 | call 1581 | ) 1582 | in 1583 | transformator 1584 | else 1585 | {apiCall("""" & workspaceId & """")}, 1586 | output = #table(type table [#"Id of Scan" = text], List.Transform(ids,each {[id]?})) 1587 | in 1588 | output 1589 | else 1590 | #table(type table [Response = text], {{"Please fill parameter of function."}}) 1591 | in 1592 | functionVarTester; 1593 | 1594 | //**** Scanner API - GET STATUS AND RESULTS 1595 | [ 1596 | DataSource.Kind = "PowerBIRESTAPI" 1597 | ] 1598 | shared PowerBIRESTAPI.ScannerAPIStatusAndResult = 1599 | Value.ReplaceType( 1600 | ScannerAPIStatusAndResult, 1601 | ScannerAPIStatusAndResultType 1602 | ); 1603 | 1604 | ScannerAPIStatusAndResultType = 1605 | type function (optional scanId as 1606 | ( 1607 | type text 1608 | meta 1609 | [ 1610 | Documentation.FieldCaption = "Scan ID", 1611 | Documentation.FieldDescription = "Scan ID that has been returned from function ""Scanner API - Get Info""", 1612 | Documentation.SampleValues = { 1613 | "xxx-xxxx-yyxa..." 1614 | } 1615 | ] 1616 | )) as table 1617 | meta 1618 | [ 1619 | Documentation.Name = "PowerBIRESTAPI.ScannerAPIStatusAndResultType", 1620 | Documentation.LongDescription = "This function will validate if the scan is successfully finished, and in that case, it returns data.", 1621 | Documentation.Examples = { 1622 | [ 1623 | Code = "=PowerBIRESTAPI.ScannerAPIStatusAndResultType(""xxx-xxxx-yyxa..."")", 1624 | Result = "" 1625 | ] 1626 | } 1627 | ]; 1628 | 1629 | ScannerAPIStatusAndResult = 1630 | (optional scanId as text) => 1631 | let 1632 | functionVarTester = 1633 | if scanId <> null and scanId <> "" then 1634 | let 1635 | statusCall = 1636 | Json.Document( 1637 | Web.Contents( 1638 | "https://api.powerbi.com/v1.0/myorg", 1639 | [ 1640 | RelativePath = "admin/workspaces/scanStatus/" & scanId, 1641 | Headers = [ 1642 | #"Content-Type" = "application/json" 1643 | ] 1644 | ] 1645 | ) 1646 | ) 1647 | [status], 1648 | validationForNextSteps = 1649 | if statusCall = "Succeeded" then 1650 | let 1651 | resultCall = 1652 | Json.Document( 1653 | Web.Contents( 1654 | "https://api.powerbi.com/v1.0/myorg", 1655 | [ 1656 | RelativePath = "admin/workspaces/scanResult/" & scanId, 1657 | Headers = [ 1658 | #"Content-Type" = "application/json" 1659 | ] 1660 | ] 1661 | ) 1662 | ), 1663 | resultOutput = 1664 | #table( 1665 | type table [ 1666 | id = text, 1667 | name = text, 1668 | #"type" = text, 1669 | state = text, 1670 | isOnDedicatedCapacity = text, 1671 | capacityId = text, 1672 | reports = list, 1673 | dashboards = list, 1674 | datasets = list, 1675 | dataflows = list, 1676 | datamarts = list, 1677 | users = list 1678 | ], 1679 | List.Transform( 1680 | resultCall[workspaces], 1681 | each 1682 | { 1683 | _[id]?, 1684 | _[name]?, 1685 | _[#"type"]?, 1686 | _[state]?, 1687 | _[isOnDedicatedCapacity]?, 1688 | _[capacityId]?, 1689 | _[reports]?, 1690 | _[dashboards]?, 1691 | _[datasets]?, 1692 | _[dataflows]?, 1693 | _[datamarts]?, 1694 | _[users]? 1695 | } 1696 | ) 1697 | ) 1698 | in 1699 | resultOutput 1700 | else 1701 | #table( 1702 | type table [Response = text], 1703 | { 1704 | { 1705 | "Scan is not completed yet. Try it later." 1706 | } 1707 | } 1708 | ) 1709 | in 1710 | validationForNextSteps 1711 | else 1712 | #table( 1713 | type table [Response = text], 1714 | { 1715 | { 1716 | "Please fill parameter of function." 1717 | } 1718 | } 1719 | ) 1720 | in 1721 | functionVarTester; 1722 | 1723 | // 1724 | // Data Source definition 1725 | // 1726 | PowerBIRESTAPI = [ 1727 | TestConnection = (dataSourcePath) => { "PowerBIRESTAPI.Navigation"}, 1728 | Authentication = [ 1729 | Aad = [AuthorizationUri = authorize_uri, 1730 | Resource = resourceUri] 1731 | ], 1732 | Label = Extension.LoadString("DataSourceLabel") 1733 | ]; 1734 | 1735 | // 1736 | // UI Export definition 1737 | // 1738 | PowerBIRESTAPI.UI = [ 1739 | Beta = true, 1740 | Category = "Power Platform", 1741 | ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") }, 1742 | SourceImage = PBIAPI.Icons , 1743 | SourceTypeImage = PBIAPI.Icons 1744 | ]; 1745 | 1746 | PBIAPI.Icons = [ 1747 | Icon16 = { Extension.Contents("PBIAPI16.png"), Extension.Contents("PBIAPI20.png"), Extension.Contents("PBIAPI24.png"), Extension.Contents("PBIAPI32.png") }, 1748 | Icon32 = { Extension.Contents("PBIAPI32.png"), Extension.Contents("PBIAPI40.png"), Extension.Contents("PBIAPI48.png"), Extension.Contents("PBIAPI64.png") } 1749 | ]; 1750 | 1751 | 1752 | 1753 | Table.ToNavigationTable = ( 1754 | table as table, 1755 | keyColumns as list, 1756 | nameColumn as text, 1757 | dataColumn as text, 1758 | itemKindColumn as text, 1759 | itemNameColumn as text, 1760 | isLeafColumn as text 1761 | ) as table => 1762 | let 1763 | tableType = Value.Type(table), 1764 | newTableType = Type.AddTableKey(tableType, keyColumns, true) meta 1765 | [ 1766 | NavigationTable.NameColumn = nameColumn, 1767 | NavigationTable.DataColumn = dataColumn, 1768 | NavigationTable.ItemKindColumn = itemKindColumn, 1769 | Preview.DelayColumn = itemNameColumn, 1770 | NavigationTable.IsLeafColumn = isLeafColumn 1771 | ], 1772 | navigationTable = Value.ReplaceType(table, newTableType) 1773 | in 1774 | navigationTable; 1775 | 1776 | Table.ForceToNavigationTable = ( 1777 | table as table, 1778 | keyColumns as list, 1779 | nameColumn as text, 1780 | dataColumn as text, 1781 | itemKindColumn as text, 1782 | itemNameColumn as text, 1783 | isLeafColumn as text 1784 | ) as table => 1785 | let 1786 | tableType = Value.Type(table), 1787 | newTableType = Type.AddTableKey(tableType, keyColumns, true) meta 1788 | [ 1789 | NavigationTable.NameColumn = nameColumn, 1790 | NavigationTable.DataColumn = dataColumn, 1791 | NavigationTable.ItemKindColumn = itemKindColumn, 1792 | NavigationTable.IsLeafColumn = isLeafColumn 1793 | ], 1794 | navigationTable = Value.ReplaceType(table, newTableType) 1795 | in 1796 | navigationTable; 1797 | -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI.query.pq: -------------------------------------------------------------------------------- 1 | // Use this file to write queries to test your data connector 2 | let 3 | x= PowerBIRESTAPI.Navigation(){[Name="Workspaces"]}[Data], 4 | y = x{[Name="Upstream Dataflows"]}[Data] 5 | in 6 | y -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI16.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI20.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI24.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI32.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI40.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI48.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI64.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/PBIAPI80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI API/PowerBIRESTAPI/PBIAPI80.png -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/resources.es.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Administrador de Servicios de Power BI 122 | 123 | 124 | Áreas de trabajo de la aplicación (Grupos) 125 | 126 | 127 | Conectarse al API de Power BI 128 | 129 | 130 | Power BI API (Español) 131 | 132 | 133 | Capacidades (Admin) 134 | 135 | 136 | Paneles 137 | 138 | 139 | Paneles (Admin) 140 | 141 | 142 | Losas de Paneles 143 | 144 | 145 | Fuentes de datos de flujos de datos 146 | 147 | 148 | Fuentes de datos de flujos de datos (Admin) 149 | 150 | 151 | Flujos de datos 152 | 153 | 154 | Flujos de datos (Admin) 155 | 156 | 157 | Fuentes de datos de conjuntos de datos (Admin) 158 | 159 | 160 | Conjuntos de datos 161 | 162 | 163 | Conjuntos de datos (Admin) 164 | 165 | 166 | Power BI API (Español) 167 | 168 | 169 | Fuentes de datos de conjuntos de datos 170 | 171 | 172 | Fuentes de datos de puerta de enlace 173 | 174 | 175 | Usarios de fuentes de datos de puerta de enlace 176 | 177 | 178 | Puerta de enlace 179 | 180 | 181 | GETDatos 182 | 183 | 184 | =PowerBIRESTAPI.GETData("datasets") 185 | Obtenga la documentación completa en https://msdn.microsoft.com/es-es/library/dn877544.aspx 186 | 187 | 188 | Devuelve datos sin procesar de cualquiera de los https://api.powerbi.com/v1.0/myorg puntos finales. 189 | 190 | 191 | 192 | 193 | 194 | Respuesta sin formato para todos los conjuntos de datos en el área de trabajo personal del usuario autenticado. 195 | 196 | 197 | Aplicaciones (Admin) 198 | 199 | 200 | Usarios de Aplicaciones (Admin) 201 | 202 | 203 | Áreas de trabajo (Admin) 204 | 205 | 206 | Usarios de áreas de trabajo (Admin) 207 | 208 | 209 | Mi área de trabajo 210 | 211 | 212 | Mis paneles 213 | 214 | 215 | Mis conjuntos de datos 216 | 217 | 218 | Mi historial de actualizaciones 219 | 220 | 221 | Mis informes 222 | 223 | 224 | Historial de actualizaciones 225 | 226 | 227 | Calendario de actualizaciones 228 | 229 | 230 | Informes 231 | 232 | 233 | Informes (Admin) 234 | 235 | 236 | Usuarios de Informes (Admin) 237 | 238 | 239 | Usuarios de conjuntos de datos (Admin) 240 | 241 | 242 | Usuarios de dataflows (Admin) 243 | 244 | 245 | Usuarios de paneles (Admin) 246 | 247 | 248 | Usuarios de áreas de trabajo 249 | 250 | 251 | Lista de áreas de trabajo 252 | 253 | 254 | Usuarios de canalización de implementación 255 | 256 | 257 | Fases de canalización de implementación 258 | 259 | 260 | Canalizaciónes de implementación 261 | 262 | 263 | Usuarios de canalización de implementación (Admin) 264 | 265 | 266 | Fases de canalización de implementación (Admin) 267 | 268 | 269 | Canalizaciónes de implementación (Admin) 270 | 271 | 272 | Mis aplicaciones 273 | 274 | 275 | Experimental 276 | 277 | 278 | Estado de la de fuentes de datos de puerta de enlace 279 | 280 | 281 | Contenido de los capacidades (Admin) 282 | 283 | 284 | GETDatosCrudos 285 | 286 | 287 | =PowerBIRESTAPI.GETData("datasets") 288 | Obtenga la documentación completa en https://msdn.microsoft.com/es-es/library/dn877544.aspx 289 | 290 | 291 | Devuelve datos sin procesar de cualquiera de los https://api.powerbi.com/v1.0/myorg puntos finales. 292 | 293 | 294 | 295 | 296 | 297 | Respuesta sin formato para todos los conjuntos de datos en el área de trabajo personal del usuario autenticado. 298 | 299 | 300 | Actas de Dataflows 301 | 302 | 303 | Páginas de Informes 304 | 305 | 306 | -------------------------------------------------------------------------------- /Power BI API/PowerBIRESTAPI/resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Workspaces 122 | 123 | 124 | Connect to Power BI API 125 | 126 | 127 | Power BI API 128 | 129 | 130 | Dashboards 131 | 132 | 133 | Dashboard Tiles 134 | 135 | 136 | Datasets 137 | 138 | 139 | Dataset Datasources 140 | 141 | 142 | Dataflows 143 | 144 | 145 | Dataflows Datasources 146 | 147 | 148 | Power BI API 149 | 150 | 151 | GETData 152 | 153 | 154 | Personal Workspace 155 | 156 | 157 | Refresh History 158 | 159 | 160 | Refresh Schedule 161 | 162 | 163 | Reports 164 | 165 | 166 | Workspaces 167 | 168 | 169 | Workspace Users 170 | 171 | 172 | Gateway Data Source Users 173 | 174 | 175 | Gateway Data Sources 176 | 177 | 178 | Gateways 179 | 180 | 181 | Gateways (Admin) 182 | 183 | 184 | Apps (Admin) 185 | 186 | 187 | App Users (Admin) 188 | 189 | 190 | Workspaces (Admin) 191 | 192 | 193 | Workspace Users (Admin) 194 | 195 | 196 | Reports (Admin) 197 | 198 | 199 | Report Users (Admin) 200 | 201 | 202 | Dataset Users (Admin) 203 | 204 | 205 | Dataflow Users (Admin) 206 | 207 | 208 | Dashboard Users (Admin) 209 | 210 | 211 | Dashboards (Admin) 212 | 213 | 214 | Datasets (Admin) 215 | 216 | 217 | Dataflows (Admin) 218 | 219 | 220 | Dataset Datasources (Admin) 221 | 222 | 223 | Dataflow Datasources (Admin) 224 | 225 | 226 | Capacities (Admin) 227 | 228 | 229 | Power BI Service Administrator 230 | 231 | 232 | =PowerBIRESTAPI.GETData(""datasets"") 233 | Get the full documentation at https://msdn.microsoft.com/en-us/library/dn877544.aspx 234 | 235 | 236 | Returns raw JSON from any of the https://api.powerbi.com/v1.0/myorg endpoints. 237 | 238 | 239 | 240 | 241 | 242 | Raw response for all the datasets in the Personal Workspace of the authenticated user. 243 | 244 | 245 | Dashboards (Personal) 246 | 247 | 248 | Datasets (Personal) 249 | 250 | 251 | Refresh History (Personal) 252 | 253 | 254 | Reports (Personal) 255 | 256 | 257 | Apps (Personal) 258 | 259 | 260 | Experimental 261 | 262 | 263 | Gateway Data Source Status 264 | 265 | 266 | Capacity Refreshables (Admin) 267 | 268 | 269 | GETRawData 270 | 271 | 272 | Execute DAX Query 273 | 274 | 275 | =PowerBIRESTAPI.GETRawData(""datasets"") Get the full documentation at https://msdn.microsoft.com/en-us/library/dn877544.aspx 276 | 277 | 278 | Returns raw data from any of the https://api.powerbi.com/v1.0/myorg endpoints. 279 | 280 | 281 | 282 | 283 | 284 | Raw response for all the datasets in the Personal Workspace of the authenticated user. 285 | 286 | 287 | Upstream Dataflows 288 | 289 | 290 | Dataset To Dataflow Links 291 | 292 | 293 | Dataflows Transactions 294 | 295 | 296 | Deployment Pipeline Users (Admin) 297 | 298 | 299 | Deployment Pipeline Stages (Admin) 300 | 301 | 302 | Deployment Pipelines (Admin) 303 | 304 | 305 | Deployment Pipeline Users 306 | 307 | 308 | Deployment Pipeline Stages 309 | 310 | 311 | Deployment Pipelines 312 | 313 | 314 | Deployment Pipeline Operations 315 | 316 | 317 | Deployment Pipeline Stage Artifacts 318 | 319 | 320 | Report Pages 321 | 322 | 323 | Metrics - Scorecards 324 | 325 | 326 | Metrics - Goals 327 | 328 | 329 | ScannerAPI - Get Info 330 | 331 | 332 | ScannerAPI - Results of Scan 333 | 334 | 335 | Report Subscriptions (Admin) 336 | 337 | 338 | Report Subscription Users (Admin) 339 | 340 | 341 | Dashboard Subscription (Admin) 342 | 343 | -------------------------------------------------------------------------------- /Power BI REST API.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/migueesc123/PowerBIRESTAPI/9d6ca60efa296e1efbdb861b7585c0fb169a4cb3/Power BI REST API.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PowerBIRESTAPI 2 | Big thank you to https://github.com/klinejordan for contributing to this repo! 3 | 4 | A Microsoft Power BI Data Connector or Power Query Connector for the Power BI REST API. 5 | 6 | The goal of this connector is to enable you as an end-user or a tenant admin to easily: 7 | - Create a catalogue of all the resources deployed to your tenant 8 | - Dashboards 9 | - Reports 10 | - Datasets 11 | - Dataflows 12 | - Pipelines 13 | - Apps 14 | - Gateways 15 | - Retrieve a list of the members and types of access for each member inside an app workspace 'aka' Group 16 | - Analyze Refresh history and error codes 17 | - View gateway cluster and datasource details 18 | - Analyze deployment pipeline operations 19 | - Call the Activity Events log 20 | ![Power BI REST API Connector](https://i.ibb.co/m8tBdtM/PBIRESTAPI.png) 21 | 22 | Some API end points perform poorly on large tenants, and as such we have included those in an "Experimental" folder as we cannot guarantee performance of these queries. 23 | 24 | # Power BI REST API Documentation 25 | Be sure to read the official documentation from Microsoft about the Power BI REST API on: 26 | https://msdn.microsoft.com/library/dn877544.aspx 27 | 28 | # To use the custom connector 29 | You can grab the .mez file from this [link](https://github.com/migueesc123/PowerBIRESTAPI/raw/master/Power%20BI%20API.mez) and place it in your Power BI custom connectors folder. No other setup is required. You should be able to see the Power BI API Custom Connector in your Get Data Window: 30 | 31 | ![Power BI API Custom Connector in Get Data window](https://github.com/migueesc123/PowerBIRESTAPI/blob/master/Power%20BI%20REST%20API.png) 32 | 33 | For more information on how to create your own custom connectors folder, please visit the [official documentation from Microsoft Power BI Custom Connectors](https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-connector-extensibility#custom-connectors). 34 | --------------------------------------------------------------------------------