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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.