How to use Get statuses/show id api using Java?


#1

Hi everyone,

I am new to Twitter API and I am working on a project which is based on Twitter analysis. I have a list of tweets and I select one tweet at time and see whether it is a reply to any tweet or not. For that I already have in_reply_to_status_id. Now I want to use this show id api by using in_reply_to_status_id.

Could anyone provide me the example that how to do it? Any ideas?

I really need help!

Regards,
Anum


#2

For Java, Twitter4J is a good library to use.

There’s a /statuses/show:id example here: https://github.com/yusuke/twitter4j/blob/master/twitter4j-examples/src/main/java/twitter4j/examples/tweets/ShowStatus.java

If you already have the tweet json, you can create Twitter4J status objects like this:

Status tweet = TwitterObjectFactory.createStatus(jsonString);

use tweet.getInReplyToStatusId() to get in_reply_to_status_id

If you have lots of tweets, you can gather those ids in batches of 100 and use http://twitter4j.org/javadoc/twitter4j/api/TweetsResources.html#lookup-long…- to get them all faster.


#3

Hey,
Thank you so much for helping me out here!! :smiley: