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


I am doing search tweet, entering authentication headers correctly but still getting error 400 Bad Request. I am nowhere near rate limits. Query is App is StockSentimentStudy2. Could someone from twitter please advise what is the problem. Please let me know if you need any more information. Thanks.


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.


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.


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


{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;; 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}}


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.


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,


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


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


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.



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


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.



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.


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?


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…


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