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
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/

Share with Power BI Enthusiasts: 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
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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.