OAuth + Request tweet content from tweet ID


#1

Hi,

I want to make the maximum possible requests to the API (350) but I only can make 150 because I don’t know how to authenticate in my case. I am working on Java.

I want to get the tweets content from tweets ID and I could do it with this code lines:

                        url = new URL("https://api.twitter.com/1/statuses/show.json?id=" + tweetId + "&include_entities=true");
                        connection = (HttpURLConnection) url.openConnection();
                        connection.setDoOutput(true);
                        connection.setRequestMethod("GET");
                        in = new BufferedReader(new InputStreamReader(connection.getInputStream()));

The problem is I want to authenticate for being able to make more requets, but I don’t know how. Before this code I have this:

        ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setOAuthConsumerKey(consumerKey);
        cb.setOAuthConsumerSecret(consumerSecret);
        cb.setOAuthAccessToken(token);
        cb.setOAuthAccessTokenSecret(tokenSecret);
        Twitter twitter = new TwitterFactory(cb.build()).getInstance();

But it is useless because I am not using the “twitter” variable. Maybe the problem is how am I calling the requests?

Thanks in advance,