Forum Discussion

Arya_A_R's avatar
Arya_A_R
Regular Visitor
1 year ago
Solved

Trying to query data with python scripts using power bi rest api

i was trying to access one of the dataset pubhlished in workspace through power bi rest api where i have admin privileges.The error recieved is "403".   Below mentioned is the code used to excute t...
  • Shahid12523's avatar
    1 year ago

    You’re getting 403 because you’re using an embed token — that only works for embedding, not for REST API queries.

     

    Fix: Use an Azure AD access token (via MSAL) with scope
    https://analysis.windows.net/powerbi/api/.default

    Then call executeQueries directly with that token.

     

     Remove the GenerateToken step.