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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
thediez
Frequent Visitor

How to send a POST request with an empty body

Dear All,

 

I have been struggling with sending a POST request with an empty body to retrieve data.

The request requires authentication via refresh token which is working fine.

It seems that the Web.Contents is still trying to use GET method.

 

let
    body = null,
    Source = Json.Document(Web.Contents("https://www.vptol.co.uk/dlatest/QuestionnaireDataWithProfile?org=whoglmat&typ=WHOData", [Headers=[#"Authorization"="Bearer "&GetAccessTokenForAcasiResponses()], Content=body]))
in
    Source

 

Yield in this error message:

 

DataSource.Error: Web.Contents failed to get contents from 'https://www.vptol.co.uk/dlatest/QuestionnaireDataWithProfile?org=whoglmat&typ=WHOData' (405): Method Not Allowed
Details:
    DataSourceKind=Web
    DataSourcePath=https://www.vptol.co.uk/dlatest/QuestionnaireDataWithProfile
    Url=https://www.vptol.co.uk/dlatest/QuestionnaireDataWithProfile?org=whoglmat&typ=WHOData

 

 

Any help is appreciated.

 

Kind regards,

thediez

1 ACCEPTED SOLUTION

@thediez  Can you check that credentials are set to Anonymous for the data source (since using Bearer Token)?

Data source settings > select from the list > Edit Permissions

OwenAuger_0-1721890748230.png

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

4 REPLIES 4
OwenAuger
Super User
Super User

Hi @thediez 

Try making this change:

body = Text.ToBinary(""),

This seemed to work for me for another API POST request.

 

Does this work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Hi @OwenAuger ,

 

Thanks for the suggestion.

 

I have updated as follows:

 

let
    body = Text.ToBinary(""),
    Source = Json.Document(Web.Contents("https://www.vptol.co.uk/dlatest/QuestionnaireDataWithProfile?org=whoglmat&typ=WHOData", [Headers=[#"Authorization"="Bearer "&GetAccessTokenForAcasiResponses()], Content=body]))
in
    Source

 

But now getting this message.

thediez_0-1721889547586.png

I suspect that adding "Content" in the brackets after "Header" is causing this error.

 

Kind regards,

Khurshed

@thediez  Can you check that credentials are set to Anonymous for the data source (since using Bearer Token)?

Data source settings > select from the list > Edit Permissions

OwenAuger_0-1721890748230.png

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Thank you so much @OwenAuger !

 

This has resolved the issue.

 

Have a great day!

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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 Kudoed Authors