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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
matanasov0204
New Member

HELP -> DataSource.Error: Web.Contents failed to get contents from (400): Bad Request

Hello there, i'm having a problem with trying to access data from API service, using Blank Query in Power BI.

= let 
    url = "https://**********/events?api-version=2016-12-12",
	body = "{""searchSpan"": {""from"": {""dateTime"":""2018-08-20T00:00:00.000Z""},""to"": {""dateTime"":""2018-08-27T00:00:00.000Z""}},""top"" : {""sort"" : [{""input"" : {""builtInProperty"" : ""$ts""},""order"" : ""Asc""}],""count"" : 2000}}""}",

	Source = Json.Document(Web.Contents(url,[
				Headers = [#"Authorization"="Bearer token",
					   #"Content-Type"="application/json"],
				Content = Text.ToBinary(body)]))		
in
   Source

 

When i put this request to the query, this is the error i recieveve:

 

DataSource.Error: Web.Contents failed to get contents from '*******/events?api-version=2016-12-12' (400): Bad Request
Details:
DataSourceKind=Web
DataSourcePath=*******/events
Url=*******/events?api-version=2016-12-12

 

Steps I already did:

1. Through Postman everything works perfectly.

2. Credentials to this URL in Data Source Settings is set to Anonymous

 

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @matanasov0204

I can't reproduce your problem.

Could you try "Get Date"->"Web", enter your url, then select "Anonymous" for credentail.

Additionally,Please reffer to below link it has similar problem and it suggest to change the code a bit.

http://www.powerpivotblog.com/getting-data-into-power-query-with-the-twitter-search-api-how-to-hack-...

 

Best regards

maggie

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