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 advanceScreenshot 2020-02-19 at 14.35.38.pngPOST request error code 403
7 REPLIES 7
Super User II
Super User II

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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







Did my reply helpful to you ? Please give Kudos

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




MattCalderwood Resolver I
Resolver I

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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.

rkq81
Frequent Visitor

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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
 
 
rkq81
Frequent Visitor

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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

Super User II
Super User II

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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







Did my reply helpful to you ? Please give Kudos

Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




rkq81
Frequent Visitor

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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
MattCalderwood Resolver I
Resolver I

Re: Power BI REST API can't POST generate token error code 403 "Api isn't supported for workspa

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.

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.