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:
&client_id=your client id from the Azure app you create above
&client_secret=your secret from the Azure app you created above
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:
Check out the Power BI REST API documentation if you want to play around with more features using the Postman app.