Back

Microsoft Power BI API Essential Guide

Aug 7, 20246 minute read

What type of API does Microsoft Power BI provide?

Microsoft Power BI primarily uses a REST API. Here are the key points about Power BI's API:

REST API

  • Power BI provides REST APIs for embedding, administration, governance and user resources.

  • The Power BI REST APIs offer service endpoints to manage Power BI content, perform admin operations, and embed Power BI content.

API Structure

  • The API is organized into different operation groups like Admin, Apps, Dashboards, Datasets, Reports, etc.

  • It uses standard REST conventions for operations on resources.

Authentication

  • Authentication is done using Azure Active Directory (Azure AD).

  • You need to register an Azure AD application to use the Power BI REST APIs.

Key Features

  • Supports throttling to maintain performance and reliability.

  • Returns detailed error messages with HTTP status codes.

  • Provides SDKs for easier integration, like a .NET SDK.

Considerations

  • Some APIs refer to workspaces as "groups".

  • Data may be processed in data centers outside your Power BI tenant's home region.

While Power BI primarily uses REST, it's worth noting that Microsoft offers GraphQL APIs for some of its other services. However, for Power BI specifically, the main API type is REST.

Does the Microsoft Power BI API have webhooks?

The official Microsoft Power BI API does not appear to have native webhook functionality. Webhooks are available in Microsoft Dataverse (formerly Common Data Service), which is part of the Power Platform that includes Power BI. However, this is separate from the Power BI API itself.

For Power BI specifically, there are some event-based capabilities, but these are not true webhooks. Power BI has events that can be listened to using JavaScript, such as report loading and button clicks. Power BI also supports "streaming datasets" which allow pushing real-time data to Power BI, but this is not the same as webhooks.

To achieve webhook-like functionality with Power BI, some workarounds have been suggested, such as using Microsoft Power Automate (formerly Flow) to create a URL that can receive data and then send it to Power BI, or having data emailed in a consistent format and using Power Automate to process the email and update Power BI.

For true webhook functionality, you may need to look at other Azure services or custom solutions outside of Power BI itself.

Rate Limits and other limitations

Based on the search results provided, here are the key points regarding the API Rate Limits of the Microsoft Power BI API:

General API Rate Limits

  1. There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried [1].

  2. This limit applies to various API operations, including executing queries against datasets [1].

  3. Power BI uses throttling to maintain optimal performance and reliability. To prevent overuse of resources from single users, Power BI limits the number of API calls within a time window per user [5].

Specific Limits for Dataset Execute Queries API

  1. Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first) [1].

  2. Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written [1].

  3. Only one query per API call and one table request per query are allowed [1].

Limitations for Push Datasets

While not directly related to the general API rate limits, there are specific limitations for push datasets that may be relevant:

  1. 120 POST rows requests per minute per semantic model [3].
  2. If a table has 250,000 or more rows, the limit is 120 POST rows requests per hour per semantic model [3].
  3. 1,000,000 rows can be added per hour per semantic model [3].

Key Considerations

  1. There is currently no way to increase the API call limit by upgrading the license or moving to premium capacity [5].

  2. The limitations are in place to maintain optimal performance and reliability of the Power BI service [5].

  3. If you're encountering rate limit errors (HTTP 429), you may need to redesign your application or report to reduce the number of API calls made within the time window [5].

Best Practices

  1. Optimize your queries and report designs to minimize the number of API calls required.

  2. Implement appropriate error handling and retry logic in your applications to handle rate limit errors gracefully.

  3. Consider caching data where possible to reduce the need for frequent API calls.

  4. For reports with multiple visuals making API calls, consider staggering the loading of these visuals or implementing pagination to spread the API calls over a longer period.

In conclusion, the 120 requests per minute per user limit is a hard limit for the Power BI API, and there's currently no official way to increase this limit. Applications and reports should be designed with these limitations in mind to ensure optimal performance and user experience.

Latest API Version

Based on the search results provided, the most recent version of the Microsoft Power BI API is 4.20.0.

Key points to consider:

  • The Microsoft.PowerBI.Api NuGet package is currently at version 4.20.0.

  • Power BI Desktop, which is a separate application from the API, has more frequent updates. The most recent version mentioned in the search results is 2.128.751.0 (April 2024 Update).

  • Power BI Report Server, another related product, also has its own versioning. The most recent version mentioned in the results is 1.14.8179.37378 (build 15.0.1108.297), released on May 26, 2022.

Best practices:

  • Always check the official Microsoft documentation or NuGet package repository for the most up-to-date version information.

  • When developing applications that use the Power BI API, ensure compatibility with the version you're using and consider any breaking changes in newer versions.

  • Keep in mind that different Power BI products (API, Desktop, Report Server) have separate version numbers and release cycles.

How to get a Microsoft Power BI developer account and API Keys?

To get a developer account for Microsoft Power BI and create an API integration, you need to follow these steps:

1. Sign up for a Power BI account

First, you need to sign up for a Power BI account if you don't already have one. You can use your existing Microsoft account or create a new one.

2. Register an Azure AD application

To use the Power BI REST APIs, you need to register an Azure Active Directory (Azure AD) application in Azure. This establishes permissions for Power BI REST resources and allows access to the Power BI REST APIs. Here's how to do it:

  1. Go to the Power BI App Registration tool and sign in using your Power BI account.
  2. Name your application and choose "Server-side web application" as the app type.
  3. Enter the home page address of your app and the redirect URL.
  4. Choose the APIs allowed for the application.
  5. On successful registration, you'll get the Application ID and Application Secret. Save these securely as you'll need them later.

3. Configure Power BI settings

To enable API access, you need to configure some settings in the Power BI admin portal:

  1. Sign in to Power BI using a Global administrator account.
  2. Go to the Admin portal.
  3. Under Developer settings:
    • Enable "Embed content in apps"
    • Enable "Allow service principals to use Power BI APIs"
    • In the "Specific security groups" field, add the appropriate security group.

4. Get an access token

To use the Power BI REST API, you need to get an access token:

  1. Use the authorization URL to get an authorization code.
  2. Exchange the authorization code for an access token by making a POST request to the token endpoint.

5. Use the Power BI REST API

Once you have the access token, you can use it to authenticate Power BI API requests.

What can you do with the Microsoft Power BI API?

Here's the markdown text with the trailing list of URLs and citation references removed, and any URLs inside the content formatted correctly for the markdown file format:

Here's a list of data models you can interact with using the Microsoft Power BI API, along with what is possible for each:

Semantic Models (Datasets)

  • Create, read, update, and delete semantic models
  • Refresh semantic model data
  • Get semantic model metadata and schema information
  • Manage semantic model permissions
  • Execute DAX queries against semantic models
  • Create and manage dataflows associated with semantic models
  • Configure data source credentials for semantic models

Reports

  • Create, read, update, and delete reports
  • Clone existing reports
  • Export reports to various formats (PDF, PowerPoint, etc.)
  • Get report pages and visuals
  • Rebind reports to different semantic models
  • Set and get report parameters

Dashboards

  • Create, read, update, and delete dashboards
  • Add, remove, and update dashboard tiles
  • Get dashboard metadata and layout information
  • Share dashboards with users or groups

Workspaces

  • Create, read, update, and delete workspaces
  • Manage workspace access and permissions
  • Get a list of items (reports, dashboards, etc.) in a workspace
  • Add or remove users from workspaces

Apps

  • Create, read, update, and delete apps
  • Publish and update app content
  • Get app metadata and content information
  • Install apps for users

Dataflows

  • Create, read, update, and delete dataflows
  • Refresh dataflow data
  • Get dataflow metadata and entity information
  • Manage dataflow permissions

Data Gateways

  • Register and unregister on-premises data gateways
  • Manage gateway permissions and data sources
  • Get gateway status and information

Capacities

  • Create, read, update, and delete capacities
  • Assign workspaces to capacities
  • Manage capacity settings and permissions

Users and Groups

  • Get user and group information
  • Manage user and group permissions for various Power BI items

Tenant Settings

  • Read and update various tenant-level settings
  • Manage organizational custom visuals

This list covers the main data models and operations available through the Power BI API. Each model allows for various interactions and management tasks, enabling developers to programmatically control and integrate Power BI functionality into their applications.