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.

Error HTTP 401 using REST API

Hi, 

 

I try to use PowerBI REST API with Postman.

1- Obtain a token

POST https://login.microsoftonline.com/common/oauth2/v2.0/token

Body :

client_id=myClienID
&grant_type=client_credentials
&scope=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi%2F.default
&client_secret=myClientSecret

 

2 - Response

{
    "token_type""Bearer",
    "expires_in"86399,
    "ext_expires_in"86399,
    "access_token""eyJ0e[...]CXlgQ"
}
 
3 - Request
Header field Authorization : Bearer eyJ0e[...]CXlgQ
 
Response : 401 Unauthorized
 
What's wrong ?
 
Thanks for your help.
Status: Investigating

Hi,

As far as I’m concerned, you should use the access token you got in the first two steps to use as the authorization to run the next requests you posted.

vrobertqmsft_0-1637825781503.png

You should select the authorization type and put the authorization text here:

vrobertqmsft_1-1637825781508.png

 

I also suggest you to go to the official document of the rest API to click on the “try it” to try the API before you run it in the Postman:

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/get-reports

vrobertqmsft_2-1637825781510.png

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

Comments
v-robertq-msft
Community Support
Status changed to: Investigating

Hi,

As far as I’m concerned, you should use the access token you got in the first two steps to use as the authorization to run the next requests you posted.

vrobertqmsft_0-1637825781503.png

You should select the authorization type and put the authorization text here:

vrobertqmsft_1-1637825781508.png

 

I also suggest you to go to the official document of the rest API to click on the “try it” to try the API before you run it in the Postman:

https://docs.microsoft.com/en-us/rest/api/power-bi/reports/get-reports

vrobertqmsft_2-1637825781510.png

 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin