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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

REST API authentication via post/cookie

Disclaimer: I've never used a REST API as a PowerBI datasource before. My experience is limited to SQL and CSV. I'm a noob.

 

I have a standard JSON-based REST API that I want to use as a datasource. The problem I have is that authentication requires a username and password to be posted to a index.html page as form data, which is validated and a cookie with a sessionID is returned/created to be used to authenticate future API calls. I've tested it in Postman and can get it to work easily (even for someone as inexperienced as me):

 

1. Set the request method to POST.
2. Enter the URL (https://[hostname]:[port]/login.html)
3. Set a Content-Type headerwith the value application/x-www-form-urlencoded
4. In the body, create a key for username and password with the appropriate values
5. Send the request and a cookie with a sessionID is returned

 

I just have no idea how to do this in PowerBI. I've done quite a bit of hunting through this community and tried to adapt some likely solutions but haven't had any luck yet. If anyone is able to point me in the right direction, I'd really appreciate it.

9 REPLIES 9
fatimaimrann123
New Member

hello did u figure out??
fatimaimrann123
New Member

hello did u figure out??
DHCookTech
Frequent Visitor

Hello @Anonymous ! Were you able to find a way to do this? I am running into the exact same situation.

v-xulin-mstf
Community Support
Community Support

Hi @Anonymous,

 

Is your issue solved?

If the issue has been solved, please share the solution and adopt it to help others.

Thanks! 😉

 

 

Best Regards,
Link

 

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

v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

Please refer this:

https://www.sqlshack.com/importing-data-from-json-files-and-power-bi-rest-apis-into-power-bi/

Detailed steps on how to import REST API data sources are described here.

 

Best Regards,
Link

 

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

Anonymous
Not applicable

Thanks very much, @v-xulin-mstf, Unfoirtunately, this doesn't cover authentication, but it's an excellent introduction to using a REST API as a datasource. I appreciate that.

Hi @Anonymous ,

 

You can refer the following posts:

https://community.powerbi.com/t5/Power-Query/Saving-Cookies-from-POST-Request-to-Rest-API/m-p/957172

https://community.powerbi.com/t5/Developer/Failed-to-get-API-authentication-by-Postman/td-p/1855644

https://community.powerbi.com/t5/Developer/REST-API-Silent-Authentication-Token/td-p/156004

Hope it helps!😉

 

Best Regards,
Link

 

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

 

amitchandak
Super User
Super User

@Anonymous , check this old power query blog- if that cab help https://eriksvensen.wordpress.com/2014/09/15/specifying-json-query-in-power-query-example-statistics-sweden/

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks a lot, @amitchandak. It doesn't help in this case unfortunately, but it's a great reference which I've bookmarked.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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