Power BI REST API
Power BI is a cloud-based service to build business intelligence dashboards for your organization. The REST API provides programmatic access to dashboard resources such as Datasets, Tables, and Rows which we can use to create custom apps that push data into a Power BI dashboard.
The REST API currently has the following operations:
- Dataset operations: Get and create Datasets
- Table operations: Get Tables and update Table schema
- Row operations: Add Rows and Delete Rows
- Group operations: Get Groups
- Import operations: Create Import, Get Imports, Get Import from GUID, and Get Import by File Path
- Dashboard operations: Get Dashboards and Get Tiles
We will go over on a technical level how to connect to Power BI API and provide an example of one of the Operations listed above.
Prerequisites: Microsoft.IdentityModel.Clients.ActiveDirectory.dll (this can be downloaded off MSDN)
Connecting to Power BI REST API.
We can create an in house function called AccessToken to give us access to Rest API.
All of the objects you see in this screen shot can be found in the Active Directory library listed above.
Authority = https://login.windows.net/common/oauth2/authorize/
ResourceURI = https://analysis.windows.net/powerbi/api
RedirectURI = https://login.live.com/oauth20_desktop.srf
Client ID = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" (This is the ID you get once you Register your Application).
Once this code is run, a screen will pop up and require you to sign in.
Once you sign in, you will now have access to the Rest API for your application.
Using Power BI REST API
In this example we will show how to get groups using the REST API.
We can create an in house function called GetGroups to return all of the Groups within Power BI.
DatasetURI = https://api.powerbi.com/v1.0/myorg
These are the class definitions used in the function that were not created by external libraries
Here is the DatasetRequest function definition.
This article was written by Jade Swanson, Technical Consultant for