0

I'm working on an Application that communicates with the Twitter API using Hammock. I'm able to authenticate using Aouth and I can return the token and the token secret. However when I try to get twitter mentions or post an update, I get a 400 error. From googling, I get that the problem has to do with System.net.HttpWebrequest according to this article http://codeknowledge.net/2011/11/03/httpwebrequest-authentication-error-400/

however I don't get how to override the default and use the custom as described in the link above.

Here is my error details: Any help would be appreciated

The remote server returned an error: (400) Bad Request.System.Net.HttpWebResponse protocolerror

Stack trace:

at System.Net.HttpWebRequest.GetResponse()
at Hammock.Web.WebQuery.ExecuteGetDeleteHeadOptions(WebRequest request, WebException& exception) in D:..........\hammock-master\src\net35\Hammock\Web\WebQuery.cs:line 1022

query.Result.Exception.TargetSite: {System.Net.WebResponse GetResponse()}

Sheridan
  • 68,826
  • 24
  • 143
  • 183
cgitosh
  • 313
  • 3
  • 12
  • Is it possible to get more information about the bugging requests and your code please ? It would be quite useful to solve the problem. – air-dex Jan 19 '13 at 01:47

1 Answers1

0

According to Twitter Developer's documentation about error response codes, it may be due to the following things :

  • If you use the 1.0 API, you have already hit the rate limit and you must wait to launch new requests.
  • If you use the 1.1 API, the Authorize header which is used for authentication is missing. Are your requests authenticated correctly ?
  • Your request can be invalid. Are your URL, headers, GET and POST arguments OK ?

Your error message indicates a "protocolerror" too. Does your URL start with "https://api.twitter.com/" ?

The answer will be edited if I have more information when I have them.

air-dex
  • 4,130
  • 2
  • 25
  • 25
  • I used tweetsharp and stepped through the code and compared to when I stepped through the code using just Hammock, I think there is a part I'm skipping or missing. so the last two points make sense. in the mean time I'm using Tweetsharp since it's working and I want to go to market quickly, then I will come back to this. Thanks – cgitosh Jan 21 '13 at 09:59