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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
acc-int-ail
Frequent Visitor

dynamic token retrieval with POST request ”DataSource.Error: Web.Contents failed to get contents 405

Hi! 

This is my last attempt of getting this to work. 

 

I am trying to integrate an REST API source to power bi, the goal is to have it incrementally refresh, but the operations for the REST API uses dynamic access tokens. So I need to make a function with power query that sends a POST request to the api to get the token.

 

To get the bearer token, I need to send a POST request to

 

https://api.<domain>.se/api/v1/token

which uses basic auth (base64-encoded string of 'username:password’). 

 

I get everything to work in postman, I have tried all kinds of different ways to make a function with power Query (see my last threads https://community.powerbi.com/t5/Power-Query/Issues-with-dynamic-token-retrieval-quot-query-DataSour..., https://community.powerbi.com/t5/Power-Query/Get-token-function-for-API-request-with-dynamic-access-...  ). And now I figured I’ve got everything working, it still returns error code 405. 

 

I’ve narrowed it down to have something to do with being a POST request? 

 

Here are the two alternatives I narrowed it down to that should work but doesn't. the first one is where I state the username and the password in the url, but I have also tried having the basic token as a header and several other things.

 

image.png

image-2.png

0 REPLIES 0

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors