Documentation - AntoineDW/powerbi-rest-api-python GitHub Wiki

List of all the available functions

General

Connect to the Power BI REST API

pbirest.connect(
    client_id,
    username,
    password,
    tenant_id = "common",
    client_secret = None
)

Verify if you have a valid token

pbirest.verify_token()

Get your current token

pbirest.get_token()

Workspaces

Get all the workspaces you have access to

pbirest.get_workspaces()

Get a specific workspace you have access to

pbirest.get_workspace(workspace_id)

Create a new workspace

pbirest.create_workspace(workspace_name, new = False)

Set the new parameter to True if you want to create a workspace V2.

Delete a workspace

pbirest.delete_workspace(workspace_id)

Users

Get all the users that have access to a workspace

pbirest.get_users_in_workspace(workspace_id)

Add a new user to a workspace

pbirest.add_user_to_workspace(workspace_id, email, access = "Member")

The access parameter must be either Admin, Contributor or Member

Delete user access to a workspace

pbirest.delete_user_from_workspace(workspace_id, email)

Update user access to a workspace

pbirest.update_user_in_workspace(workspace_id, email, access = "Member")

The access parameter must be either Admin, Contributor or Member

Reports

Get all the reports in a workspace

pbirest.get_reports(workspace_id)

Get a specific report in a workspace

pbirest.get_report(workspace_id, report_id)

Delete a report

pbirest.delete_report(workspace_id, report_id)

Export a report

pbirest.export_report(workspace_id, report_id, out_file)

Import a report

pbirest.import_report(workspace_id, report_name, in_file, name_conflict = "CreateOrOverwrite")

The name_conflict parameter must be either CreateOrOverwrite, GenerateUniqueName, Ignore or Overwrite

Clone a report

pbirest.clone_report(workspace_id, report_id, dest_report_name, dest_workspace_id = None)

If the dest_workspace_id parameter is None, the report will be cloned in the same workspace

Datasets

Get all the datasets in a workspace

pbirest.get_datasets(workspace_id)

Get a specific dataset in a workspace

pbirest.get_dataset(workspace_id, dataset_id)

Delete a dataset

pbirest.delete_dataset(workspace_id, dataset_id)

Refresh a dataset

pbirest.refresh_dataset(workspace_id, dataset_id, notify_option = "NoNotification")

The notify_option parameter must be either MailOnCompletion, MailOnFailure or NoNotification

Admin

Get audit logs

pbirest.get_audit_logs(start_date, end_date, activity = None, user_id = None)

The start_date and end_date parameters must match the following pattern: YYYY-MM-DD HH:MM:SS

Here's a list of all the values the activity parameter can take