Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RicFischer
Helper I
Helper I

REST API Permissions issue for Admin part of API

I'm using the Power BI Python library by Alex Reed (areed1192/power-bi-python-api: The Unofficial Python API wrapper for the Microsoft Power BI REST API...). I added my own portion for the Admin part of the REST API. It currently only has the Get Reports as Admin function in it.

 

I got that part working. But, I appear to be having a permissions issue. The response I'm getting back is a 401. The logging feature in Mr. Reed's library is reporting this:

 

 

2021-11-22 16:29:55,812|session.py|URL: https://api.powerbi.com/v1.0/myorg/admin/reports
2021-11-22 16:29:56,163|session.py|{
    "error_code": 401,
    "response_url": "https://api.powerbi.com/v1.0/myorg/admin/reports",
    "response_body": "",
    "response_request": {
        "Authorization": "Bearer XXXXXXX",
        "Content-Type": "application/json",
        "Content-Length": "2"
    },
    "response_method": "GET"
}

 

 

The permissions for my app are here:

 

RicFischer_0-1637689022213.png

 

Can anybody think of what else I need to check? I feel like I'm so close.

 

Thank you for your help.

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @RicFischer ,

From this error code 401, it seems that the authentication information provided is incorrect causing the API to fail to run. First, check to see if the account which you used to run Admin Rest API has the following privileges:

yingyinr_0-1637910648871.png

Also, please review the content in the following links. Hope they can help you.

Permission types

API call returning 401

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.