Hi,
I am looking for a very simple way to post status updates to a dedicated Twitter account.
Currently we are using a POST request to https://api.twitter.com/1/statuses/update.xml with https basic auth. But Twitter is going to disable this API: http://apiwiki.twitter.com/Authentication
This oauth stuff is really, really complicated and not explained well at all.
I tried to use signpost but after playing around with that for hours, all I get is a 401.
OAuthConsumer consumer = new DefaultOAuthConsumer(consumerKey, consumerSecret, SignatureMethod.HMAC_SHA1);
consumer.setTokenWithSecret(accessToken, tokenSecret);
URL url = new URL("https://api.twitter.com/1/statuses/update.xml");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Setup the header for the request
connection.setRequestMethod("POST");
connection.setRequestProperty("User-Agent", "Status Updater");
consumer.sign(connection);
// write the message
connection.setDoOutput(true);
OutputStream os = connection.getOutputStream();
os.write(("status=" + message.substring(0, Math.min(message.length(), 139))).getBytes("UTF-8"));
os.close();
// send the request
connection.getInputStream().close();