
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
![]() | Your help is appreciated. |
|---|
This is a simple library that makes it easy to use the Power Bi REST API and Fabric REST API. We have cover more than 85% of PowerBi request and now we are working with Microsoft Fabric too. We hope one day SimplePBI will contain all the categories in both APIs, our at least that's our vision dream. Feel free to check the doc to get a deeper understanding of a specific request:
We are doing our best to make this library useful for the community. This project is not a remunerable job for us. It's a public community open source project. It's a way to express our passion of sharing knowledge. Please be patient if you submit an issue and it's not fixed right away.
Each category is an Object. This means we need to initialize an object to start using its methods. In order to create them we need the Bearer token that can be obtain from a Token Object.
Let's see how we can create an Admin Object to try the requests in that category.
# Import library
from simplepbi import token
from simplepbi import admin
from simplepbi.fabric import adminfab
We always need to import token object to create the object to run requests. Then we can pick the object of the Power Bi Rest API category we need. For instance "admin". The token can be created in two ways, the regular authentication and the service principal one. It depends which one you pick to complete the request. These are the necessary arguments to get a token:
NOTE: if you want to use service principal, be sure to have your tenant ready for that.
Register app example: https://blog.ladataweb.com.ar/post/188045227735/get-access-token
Service Principal permissions for admin api: https://docs.microsoft.com/en-us/power-bi/admin/read-only-apis-service-principal-authentication
# Creating objects
#Regular Login
tok = token.Token(tenant_id, app_client_id, username, password, None, use_service_principal=False)
#Service Principal
tok = token.Token(tenant_id, app_client_id, None, None, app_secret_key, use_service_principal=True)
ad = admin.Admin(tok.token)
it = adminfab.Items(tok.token)
As you can see the Token object contains a token attribute with the Bearer used by Azure to run rest methods. That attribute will be user to create the category objects like admin. Once we create our Object like admin, we can start using the requests adding the correct parameters if they are needed.
# Getting objects
All_Datasets = ad.get_datasets()
Datasets_In_Groups = ad.get_datasets_in_group(workspace_id)
Items_In_Workspace = it.list_items(workspace_id)
The library get requests will return a response object .json() that python reads it as a Dict.
The core requests at Fabric are the operational requests for regular users. Some examples are workspaces, folders, items, git integration, schedules or gateways. It contains a subcategory items that can handle any item created at fabric. You can list items and pick a type report for the get. Items can be anything like notebooks, pipelines, semantic models, etc.
There are some methods in the classes that still need more testing. Those will have a "preview" at the end of the name. Please let us know if something goes wrong with those. All Fabric requests are in "preview" even though they don't have the clarification at the name.
Right now the library is consuming endpoints from:
If you want to get a deeper look on complex Admin methods and unique methods. Check this doc
We have added a new feature to include some Azure Resource API Manager. The new "azpause" class will let you Pause or Resume Azure tabular or capacity resources. With SimplePBI you can pause and resume Fabric, Power Bi Embedded or Azure Analysis Services resources. Check this doc
There an aditional library Utils for transformations. It is used to help some requests returning different values. The most useful method in the Utils class might be to_pandas. You can use the method to convert simple dicts to pandas. It needs the dict and the key father of a list of dicts in the response. The usual get responses are using "value" as the key. We are also adding new methods with the requests to help get new actions. Examples:
Small categories like Dataflow Storage Accounts and Available Features were moved to Groups and Admin.
We are still developing the library. The following endpoints from admin are still missing
FAQs
Simplify usage of Power Bi Rest API
We found that simplepbi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.