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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
hellokelly
Helper I
Helper I

How to set up a link with post request of web source

Hi  @lbendlin,

 

Can you guide me how to create a web connector with a post request and password?

 

 

 

12 REPLIES 12
amitchandak
Super User
Super User

Hi @amitchandak ,

 

Thanks for the link.

But I couldnt find a good solution among them.

Could you pls help to convert below query to M code?

hellokelly_1-1662621310398.png

 

 

Not enough details on the authentication method you want to use. Missing the password identifier, for example.

Hi @lbendlin ,

 

The authentication is basic,for password identifier,what do you mean?

Querying Web.Contents with basic authentication | MrExcel Message Board

 

use the header [Headers =[#"Authorization"="Basic username:password"]]
And the username and password string must be encoded using base64 encoding

Hi @lbendlin ,

 

Thank you.

Finally I succeeded with the following code:

headers=[#"Content-Type"="application/json",Cookie=dict_cookie],
query=[],
content="",
web=Text.FromBinary(Web.Contents(rootURL,[Headers=headers,Query=query,Content=Text.ToBinary(content)]))

But when I upload it to power bi report server,when I configure the data source as Anonymous, it returns an error as below:(In desktop I also configure as anonymous)

Web.Contents failed to get contents from 'http://10.108.115.192:9000/getStatusData' (405): METHOD NOT ALLOWED

Why?Can you help me ?

Hi  @lbendlin 

I have adjusted my code as below:

let
   rootURL="http://10.108.115.192:9000/getStatusData",
   Credentials = "USERNAME=""xxxx"":PASSWORD=""xxxx""",
   EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(Credentials), BinaryEncoding.Base64),
   dict_cookie="{permission=""u"";uid=20;uname=""xxxx""}",
   headers=[#"Content-Type"="application/json",#"Authorization"="EncodedCredentials",Cookie=dict_cookie],
   query=[],
   content=""
   web=Text.FromBinary(Web.Contents(rootURL,[Headers=headers,Query=query,Content=Text.ToBinary(content)]))
in 
     web

Also I succeeded in desktop,but failed in report server, is there any error?

I have checked the server setting,seems a get request, is there any workround to fix such senario?

hellokelly_0-1662690429401.png

 

 

Hi @hellokelly ,

 

Pay more attention to status code 304.

 

Do you have a on-premises gateway installed? If the desktop refresh is successful, please try to refresh the cloud data using the on-premises gateway.

vchenwuzmsft_0-1662716704606.png

 

https://docs.microsoft.com/en-us/power-bi/connect-data/service-gateway-mashup-on-premises-cloud 

 

Best Regards

Community Support Team _ chenwu zhu

 

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

Hi @v-chenwuz-msft ,

 

Thank you,but i'm using power bi report server,not service,dont need gateway.

Re-read the part about how to encode credentials.

Hi @lbendlin ,

 

Have tried using credentials:

 

let
   rootURL="xxxx",
   dict_cookie="{permission=""u"";uid=20;uname=""xxxx""}",
   Credentials = "USERNAME=""xxxx"":PASSWORD=""xxxx""",
   EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(Credentials), BinaryEncoding.Base64),
   headers=[#"Content-Type"="application/json",#"Authorization"="EncodedCredentials",Cookie=dict_cookie],
   query=[],
   content="",
   web=Text.FromBinary(Web.Contents(rootURL,[Headers=headers,Query=query,Content=Text.ToBinary(content)]))
in
  web
  

 

But no use.The problem is when I tested in desktop,it is sending a post request with cookie,but in report server,whatever I wrote in power query,it always sent a get request without cookie inside.Do you know why?

hellokelly_0-1663029262569.png

 

your credentials string is still incorrect, needs to be in this format:

 

Credentials = "xxxx:xxxx",

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors