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