cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ukeasyproj Member
Member

questions regarding using RESTful API as data source

Before I can pull data, I need to do the following:

 

 

Authentication is managed using HTTP one (only “Basic” is supported right now). Every request must include an authorization HTTP Header. Also, authentication uses ASP.NET authorization cookies. To get an authorization cookie, use an HTTP POST request to send ‘username’ and ‘password’ to http://website.com. Each request must include this authorization cookie: .ASPHAUTH.

 

How would I do this in powerbi?

1 ACCEPTED SOLUTION

Accepted Solutions
ukeasyproj Member
Member

Re: questions regarding using RESTful API as data source

it turns out it was an error on my part regarding the link that I used for my api call, it shouldve been https not http, everything works now

7 REPLIES 7
v-ljerr-msft Super Contributor
Super Contributor

Re: questions regarding using RESTful API as data source

Hi @ukeasyproj,

 

According to your description, you may need to get the cookies elsewhere first(it is not possible to use Power BI to get the cookies currently), then you should be able to use Web Connector with your page URL and all your required HTTP Request Headers(including the cookies you have got) to get the data source in this scenario.Smiley Happy

 

cookies.PNG

 

Regards

ukeasyproj Member
Member

Re: questions regarding using RESTful API as data source

Hey @v-ljerr-msft, thanks for the response.

 

I am able to send an http get request using postman to the api with just a authorization HTTP header and get a response (without a cookie)

 

however when I try to do the same in powerquery, it says user not authorized

 

this is my power query:

 

= let
actualUrl = "http://webpage.net/rest/v1/projects",
options = [Headers =[#"Content-type"="application/json", #"Authorization"="Basic usernamepassword(in base 64 encoding)"]],
result = Json.Document(Web.Contents(actualUrl, options))
in
result

v-ljerr-msft Super Contributor
Super Contributor

Re: questions regarding using RESTful API as data source

Hi @ukeasyproj,

 

Have you tried setting the Cookie explicitly instead of using Authorization in the Headers to see if it works?Smiley Happy

 

Regards

ukeasyproj Member
Member

Re: questions regarding using RESTful API as data source

it turns out it was an error on my part regarding the link that I used for my api call, it shouldve been https not http, everything works now

v-ljerr-msft Super Contributor
Super Contributor

Re: questions regarding using RESTful API as data source

Hi @ukeasyproj,

 

Great to hear the problem got resolved!Smiley HappyCould you accept your reply as solution to help others who has similar issue easily find the answer and close this thread?

 

Regards

MeryBen Frequent Visitor
Frequent Visitor

Re: questions regarding using RESTful API as data source

Hi @v-ljerr-msft,

 

Can you please, say how to set cookies in connexion ?

 

Regards

adarshmadrecha Frequent Visitor
Frequent Visitor

Re: questions regarding using RESTful API as data source

Can you please share your working M Code