cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rkq81
Frequent Visitor

Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspace V1"

Hello - I am working with Power BI Embedded and successfully got a working embedded report running locally using an access token generated using POWERSHELL

and have successfully sent this GET request to the power BI API 

https://api.powerbi.com/v1.0/myorg/groups/{my group ID}/reports/- so I think authentication is ok -

 

However when I try to do a POST request to test generating a token (I want to test refreshing the access token before using API in JS) using

 

 
I get the error code 403 - 
 
"error": {
        "code""InvalidRequest",
        "message""Api isn't supported for workspace V1"
    }
 
What am I doing wrong? Thanks in advancePOST request error code 403POST request error code 403
7 REPLIES 7
MattCalderwood
Responsive Resident
Responsive Resident

Hi @rkq81 

@Jayendranis correct in that the endpoint you are using is restricted to V2 workspaces.
If you aren't ready to upgrade to V2 just yet (but you will need to soon) - you can use the alternative api endpoint for generating an access token for individual reports.

https://docs.microsoft.com/en-us/rest/api/power-bi/embedtoken/reports_generatetokeningroup

This endpoint will require a single report-id and workspace-id (group), but it will work with V1 and V2 workspaces.

If you only want an access token for a single report, then this is the endpoint to use.

Hi @MattCalderwood 

 

Thanks for your reply. When I try that endpoint I get a '403 Forbidden' reponse

 

{
    "error": {
        "code""Unauthorized",
        "message""User is not authorized"
    }
}
 
I'm an admin on Power BI but maybe I need more authorization somewhere else,
 
thank you
 
 
MattCalderwood
Responsive Resident
Responsive Resident

HI @rkq81 
Even if you are an admin of the Power BI Tenant you will need to double check the account permissions which you are using to access the API.

How are you generating the access token? username & password or Service Principal account?

I have checked the GenerateToken endpoint this morning with my own accounts and this works as expected, so it makes me think that the original error message might be misleading if you are already in a V2 workspace.

It's worth going back and checking the permissions set on the account you are using for API access.
This is the thing that has often caught me out in the past.

There are a number of required scopes for your original endpoint
https://docs.microsoft.com/en-us/rest/api/power-bi/embedtoken/generatetoken

PowerBI_ApiPermissions.PNG

403 errors will often be scope related if the credentials/tokens you are using can use other parts of the API.

Jayendran
Solution Sage
Solution Sage

Hi @rkq81 ,

 

Please see the restriction of the GenerateToken API as per that this will work only in V2 workspace.

Capture.JPG

 

 

There are 2 types of workspaces in PowerBI

 

  1. Classical Workspace (v1)
  2. New Workspace (v2)

Currently you are using V1 workspace which is not supported for this API. So please upgrade your workspace to V2 , please refer the below link on how to upgrade to V2 from V1 workspace

 

https://docs.microsoft.com/en-us/power-bi/designer/service-upgrade-workspaces

rkq81
Frequent Visitor

Hi @Jayendran 

 

Thanks for your response - when I go to upgrade my workspaces I don't have the same menu as the tutorial to upgrade (please see screenshot) any idea what permissions I might be missing? Clearly I don't have all the authorization I need but I am an admin in power BI - 

 

Screenshot 2020-02-24 at 09.20.38.png

 

Any advice? Thanks for your help so far

Hi @rkq81 ,

 

From the screenshot it seems you already in V2 workspace. Because only in the V2 workspace you get the options called Workspace Settings/Workspace access

 

In V1 workspace you will see the Edit this workspace

rkq81
Frequent Visitor

So... Hmm how come I'm still getting that response 403 forbidden from the API - 

 

{
    "error": {
        "code""InvalidRequest",
        "message""Api isn't supported for workspace V1"
    }
}
 
... something weird is going on!
 
Thanks for the response

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!