Hello everyone, I have been assigned the task of making it possible to update my twitter status using the OAuth tool (programming in java using the twitter4j library in Eclipse)…but I have been trying at it for the last couple of days and I have ran into a few problems so I want to make sure to establish the information needed correctly.
First: The application creation: I am new to this OAuth tool and the whole application creation using the dev.twitter.com tools. First I am confused as to what my settings should be for the application when I create it, like what my website name should be?(I just put a random website, because I don’t actually have the application on the web I am just running the code) and what should the CallbackURL (Have no idea whether I need this or not) be? All I am trying to do is write java code using Eclipse and the twitter4j library than running it to update my twitter status something like this:
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.OAuthAuthorization;
import twitter4j.conf.ConfigurationBuilder;
public class TwitterTest {
private static final String ACCESS_TOKEN = "MY ACCESS_TOKEN";
private static final String ACCESS_TOKEN_SECRET = "MY ACCESS_TOKEN_SECRET";
private static final String CONSUMER_KEY = "MY CONSUMER_KEY";
private static final String CONSUMER_SECRET = "MY CONSUMER_SECRET";
public static void main(String[] args) {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setOAuthAccessToken(ACCESS_TOKEN);
builder.setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET);
builder.setOAuthConsumerKey(CONSUMER_KEY);
builder.setOAuthConsumerSecret(CONSUMER_SECRET);
OAuthAuthorization auth = new OAuthAuthorization(builder.build());
Twitter twitter = new TwitterFactory().getInstance(auth);
try {
twitter.updateStatus("Hello World!");
} catch (TwitterException e) {
System.err.println("Error occurred while updating the status!");
return;
}
System.out.println("Successfully updated the status.");
}
}
So if anyone could help me as to how to actually get it to where I can just put in my Keys/Secret Codes in the code above and then run the code and make it update my status (tweet) Hello World! on my twitter account that would be great!