How to Call the Power BI REST API from Postman

2 Comments
BEFORE WE START, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

The Postman app is useful as a developer if you want to send requests and see responses when interacting with Web APIs, as well as seeing what the calls actually do. In this post, we will look at how to call the Power BI REST API from Postman.

First, follow the instructions here to register an Azure App to use with Power BI. Note the client id and secret.

Next, install Postman for Windows and open it. Create a new Request. We will create a request to get a Bearer that we will use to authenticate with the Power BI API. The type will be POST and we will be sending the request to https://login.microsoftonline.com/common/oauth2/token. We will also send the Content-Type in the Header as application/x-www-form-urlencoded:

Next, click on the Body and click on Raw, and send through the following:

grant_type=password
&username=your@email.com
&password=yourpassword
&client_id=your client id from the Azure app you create above
&client_secret=your secret from the Azure app you created above
&resource=https://analysis.windows.net/powerbi/api

Click on Send. We get the access_token returned, which we will use in our next request as the Bearer. Copy it:

Now let’s create a request to the Power BI API. Let’s get a list of Apps in Power BI. We will send through the GET request https://api.powerbi.com/v1.0/myorg/apps, and in the Headers we will add an Authorization key, with the value as Bearer <your access token>:

We get the apps returned in the response:

Pretty easy!

Check out the Power BI REST API documentation if you want to play around with more features using the Postman app.

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

2 Responses to How to Call the Power BI REST API from Postman

  1. Hi.. I keep on getting an invalid grant. 🙁

    “error”: “invalid_grant”,
    “error_description”: “AADSTS50126: Error validating credentials due to invalid username or password.

    Can you help please.

Leave a Reply

Your email address will not be published. Required fields are marked *