Upload a local PBIX file using the import API

We are currently previewing a new REST API that will allow a developer to programmatically upload a Power BI designer file (PBIX) to a user’s workspace. This new API is called the Import API and it is currently available in our beta version of the Power BI API. The vision for the import API is that it will allow a developer to take a package of content like a PBIX or Excel file, import it into a user’s Power BI workspace. This will split the package into its individual parts like datasets and reports. It will then provide a metadata link between the actual import operation and the objects that were created from it.

Let’s look at an example of how to call the import REST API to import a PBIX file. In this example, I will be using a tool called fiddler.

When the request is executed, you will receive a 202 accepted response. This does not mean that the import has completed. The import operation is actually run asynchronously. 202 means that it has been queued. In the response body you will also receive the import ID which can be used to monitor the status of the import:

To check the status, you need to make a GET call to “https://api.powerbi.com/beta/myorg/imports/1db51a3d-94ea-4a43-9df2-10ab08c1922a”. This call requires the following permission scope: View content properties (preview).

If the import is complete, you will see a JSON response that will look something like this:

The response includes all the information about the report and dataset that was created. It even includes a deep link to view the report in the Power BI UI.

In the service itself, the user will also see the newly created artifacts: