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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
janakiram
Regular Visitor

Bad Request in Power Query

Hi All,

I am very new to Power Query!!!

 

I am getting below error while connecting below url

Details: "Web.Contents failed to get contents from https://api.twitter.com/1.1/search/tweets.json?q=PowerPivot  (400): Bad Request".

Please suggest, same error is coming for any search key word.

 

Regards,

Ram

1 ACCEPTED SOLUTION
sethigurpreer
Frequent Visitor

 

Hi Janki,

 

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-...

 

Existing Code

 

let
Source = Web.Contents(“https://api.twitter.com/1.1/search/tweets.json?q=PowerPivot”)
in
Source

 

New Code

let

Source = Web.Contents(“https://api.twitter.com/1.1/search/tweets.json?q=PowerPivot&count=100″, [Headers=[#”Authorization”=”OAuth oauth_consumer_key=””YOURKEY””, oauth_nonce=””YOURCODE””, oauth_signature=””YOURSIGNATURE””, oauth_signature_method=””HMAC-SHA1″”, oauth_timestamp=””TIMESTAMP””, oauth_token=””YOURTOKEN””, oauth_version=””1.0″””]]
)
in
Source

 

Hope this will help.

 

Regards

Gurpreet Sethi

View solution in original post

8 REPLIES 8
ReportGuru
Post Patron
Post Patron

Hi @janakiram were you able to find a solution? As a workaround, maybe you can try to test your connection with a 3rd party connector. I've tried windsor.ai, supermetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Salesforce connector in the data sources list:

 

SALESFORCE-1.png

 

After that, just grant access to your Salesforce account using your credentials, then on preview and destination page you will see a preview of your Salesforce fields:

 

SALESFORCE-2.png

 

There just select the fields you need. It is also compatible with custom fields and custom objects, so you'll be able to export them through windsor.  Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url. 

 

SELECT_DESTINATION_NEW.png

mahimabedi
Responsive Resident
Responsive Resident

Where do we get the auth details from? Trying to use the API in PBI desktop.

 

 

OAuth oauth_consumer_key=””YOURKEY””, oauth_nonce=””YOURCODE””, oauth_signature=””YOURSIGNATURE””, oauth_signature_method=””HMAC-SHA1″”, oauth_timestamp=””TIMESTAMP””, oauth_token=””YOURTOKEN””, oauth_version=””1.0″””]]

sethigurpreer
Frequent Visitor

 

Hi Janki,

 

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-...

 

Existing Code

 

let
Source = Web.Contents(“https://api.twitter.com/1.1/search/tweets.json?q=PowerPivot”)
in
Source

 

New Code

let

Source = Web.Contents(“https://api.twitter.com/1.1/search/tweets.json?q=PowerPivot&count=100″, [Headers=[#”Authorization”=”OAuth oauth_consumer_key=””YOURKEY””, oauth_nonce=””YOURCODE””, oauth_signature=””YOURSIGNATURE””, oauth_signature_method=””HMAC-SHA1″”, oauth_timestamp=””TIMESTAMP””, oauth_token=””YOURTOKEN””, oauth_version=””1.0″””]]
)
in
Source

 

Hope this will help.

 

Regards

Gurpreet Sethi

Thanks Gurpreet, I will check on this.

 

By

Ram.

I have tried as per the advise but i got one error as " Download Failed" at "Close & Load" Step". Please help what could be the error cause.

 

 

 

a.png

 

By

Ram

Hi Ram,

 

Please share with the us Power Query code which gets generated.

 

Regards

Gurpreet Sethi

let
Source = Json.Document(Web.Contents("https://api.twitter.com/1.1/trends/available.json&oauth_consumer_key=***&oauth_nonce=682713328&oauth...
in
Source

 

Capture.PNG

 

 

Even getting error If i remove Json.Document() and only keep web.contents() 

 

I am trying to pull the data as below request too

>> https://api.twitter.com/1.1/search/tweets.json?q=spotfire&count=100

 

 

BY 

Ram

This started last Friday (March 4th, 2016).  The only change event I can correlate this to is Salesforce Require Critical update on 3-4-2016: TLS 1.1 or higher for HTTPS connections.

Thanks for any suggestions to workaround.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.