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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors