Error 400 Bad Request inspite of valid query, seemingly valid authentication headers and not overrruning rate limits


#1

I am doing search tweet, entering authentication headers correctly but still getting error 400 Bad Request. I am nowhere near rate limits. Query is https://api.twitter.com/1.1/search/tweets.json?q=IBM. App is StockSentimentStudy2. Could someone from twitter please advise what is the problem. Please let me know if you need any more information. Thanks.


#2

It would be useful to monitor the output of application/rate_limit_status.json?resources=search before and after you experience being rate limited, as well as the X-Rate-Limit-* headers in the HTTP response you receive once rate limited.


#3

Thanks Taylor for the reply. I dont think I am rate limited as I am sending less than 10 requests in 15 minutes and also dont see X-Rate-Limit-* headers in the HTTP response. There seems to be some other issue. Please advise. Thanks.


#4

What’s the actual response you’re getting back from the server with that HTTP 400?


#5

{StatusCode: 400, ReasonPhrase: ‘Bad Request’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:{ strict-transport-security: max-age=631138519 X-Cache: MISS from credit-suisseus Age: 0 Connection: Keep-Alive Date: Tue, 22 Oct 2013 14:38:32 UTC Set-Cookie: guest_id=v1%3A138245271221292205; Domain=.twitter.com; Path=/; Expires=Thu, 22-Oct-2015 14:38:32 UTC Server: tfe Via: 1.0 credit-suisseus (squid/3.1.11) Content-Length: 61 Content-Type: application/json; charset=utf-8}}


#6

I posted response some time back but may be it got stuck in validation queue. Anyways I would be really thankful if you could look into your logs for my app StockSentimentStudy2 if you see anything missing or wrong in my request. Many thanks.


#7

This indicates something is malformed about your request. Are you using some kind of proxy server or something? It’s not obvious to me whether this is coming from Twitter or not,


#8

Yes my organization’s proxy server sits in between. Do you think its doing something to the request. Thanks.


#9

Yes, it’s a likely contributor to your issues.


#10

Hi Taylor, I did some investigation and found out that when I send request in header I am just adding Authorization and proxy server seems to be appending host and connection to my request’s header. Do you think this is causing twitter to reply as bad request.

Thanks.


#11

It’s possible. Do you have any example of the kind of header values being added?


#12

After my Authorization part ends, Host:api.twitter.comConnection:Keep-Alive . This is default, I also tried Connection as Close but same bad request 400 problem.

Thanks.


#13

Hi Taylor, could you please update on if above added header values are making twitter identify request as invalid request. They otherwise seem to me to be valid header values. Thanks.


#14

Not sure if this is helpful, but…
Have you verified that you are able to authenticate with your proxy server, for example, by making a request to another web service (i.e. not Twitter) that does not require authentication?


#15

Yes it works fine with Wikipedia… could someone from Twitter please look into my request coming from this user id and application StockSentimentStudy and advise whats going wrong… Many thanks…


#16

Error 400 bad request after doing all hardwork annd doing everything here with dev twitter
And to obtain security credit when i enabled login notification