Stauses_update returning 400 Bad request


#1

Hi,

I am trying to publish a tweet from my java code.
I got the sample code from https://github.com/cyrus7580/twitter_api_examples

My code is working out fine till obtaining the access token but when i try to post to twitter using the access token it gives a “BAD REQUEST” error,
I am using httpclient library to do a post to “https://api.twitter.com/1.1/statuses/update.json” an attaching authorization header as follows:

HttpPost httppost = new HttpPost(“https://api.twitter.com/1.1/statuses/update.json”);
httppost.setHeader(“Content-Type”,“application/x-www-form-urlencoded”);
httppost.setHeader(“Authorization”,authorization_header_string);

and my authrization header String is as follows:
“OAuth oauth_consumer_key=”" + my_oauth_consumer_key +
"",oauth_nonce="" + generated_oauth_nonce +
"",oauth_signature="" + URLEncoder.encode(generated_oauth_signature,“UTF-8”) +
"",oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=""+geneated_oauth_timestamp +
"",oauth_token="" + URLEncoder.encode(my_oauth_access__token,“UTF-8”) +
"",oauth_version=“1.1"” + “”" ;

The Method I am using to create the oauth_signature is same as the method used for accessing request_token and access_token so i don’t think there is a problem in oauth_signature.
I am not using any twitter libraries like Twitter4j. I would like to do it hrough the rest API calls directly.

Thanks in Advance
Deepak