Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

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