Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jjr10
Frequent Visitor

POST request and refresh time on bearer token API

Hi all,

 

I've been building a dashboard which utalizes a few APIs from various sources, howver I am having issues with the one I am trying to bring in now.

 

Unlike the others, this API requires a initial HTTP POST request to be made to get a bearer token which is then used in the request to bring in the API. I have been able to make the POST request in Postman to retrieve the bearer token, which I then am able to use in PowerBI.

 

The POST request (on postman looks like this):

 

POST https://api.electricityinfo.co.nz/login/oauth2/token?grant_type=client_credentials&client_id=#myClie...

 

with the client ID and Secret being those I get from signing up for use of this API. This all works fine, however the issue is I want to be able to do this step in PowerBI. The other problem is that this bearer token resets every 7200 seconds. I am wondering if there is a way around this so that I do not have to change this everytime a new token is issued?

 

Currently this is the request I am making in PowerBI to get the API through the use of the bearer token:

 

Get Data -> Web -> Advanced

ss_pbiEg.png

I really appreciate anyones help, thanks all!

1 REPLY 1
v-xiaosun-msft
Community Support
Community Support

Hi @jjr10 ,

 

If you want to make a POST request to a web service through Power Query, you have to add the relevant data in the “Content”-parameter of the query. And you can use Json.FromValue which provides a super-easy way to create POST-calls to web services that require JSON format in their body parameters.

And about the bearer token resets every 7200 seconds, you can refer to the following links which may be helpful to you.

Solved: Bearer Token expires, how to get new token - Power Platform Community (microsoft.com)

Solved: POST Request Error - Microsoft Power BI Community

Easy POST requests with Power BI and Power Query using Json.FromValue – The BIccountant

 

Best Regards,
Community Support Team _ xiaosun

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.