Migrating from 2.2.x to 3.0.x
– Rebuild your project first!
Version 3.0.x is compatible with Twitter API1.1, but slightly incompatible with previous versions of Twitter4J. Projects that have been using previous versions are required to be rebuilt to migrate to Version 3.0.x.
– method migration
Following methods were retired and application need to use equivalent method (if exists).
Retired method | migrate to |
---|---|
disableNotification() | updateFriendship() |
enableNotification() | updateFriendship() |
getProfileImage() | User#getBigger|Mini|OriginalProfileImageURL() |
getBlockingUsersIDs() | getBlocksIDs() |
getLocationTrends() | getPlaceTrends() |
getAllUserLists() | getUserLists() |
getAvailableTrends(GeoLocation) | getClosestTrends(GeoLocation) |
getFavorites(int) | getFavorites(Paging paging) |
getBlockingUsers() | getBlocksList(cursor) |
getPublicTimeline() | N/A |
AccountTotals getAccountTotals() | N/A |
IDs getNoRetweetIds() | N/A |
IDs getRetweetedByIDs(long) | N/A |
IDs getRetweetedByIDs(long, Paging) | N/A |
getRetweetedByMe() | N/A |
getRetweetedByUser() | N/A |
getRetweetedToMe() | N/A |
getRetweetedToUser() | N/A |
getRetweetsOfMe() | N/A |
getDailyTrends() | N/A |
getWeeklyTrends() | N/A |
getRetweetedBy() | N/A |
boolean existsBlock() | N/A |
boolean existsFriendship() | N/A |
boolean test() | N/A |
– OAuth requirement
Twitter4J 3.0.x hits Twitter API 1.1. And all Twitter API 1.1 endpoints including the Search API require OAuth authorization unlike Twitter API 1.0 / previous versions of Twitter4J.
– Search API is finally part of REST API
For the historical reasons, the Search API had been differ from the REST API and response schema was slightly different. Finally the Search API is part of the REST API and QueryResult returns Status instance. Tweet interface is removed from version 3.0.0.
– Retirement of Android build
As of version 3.0.3, Twitter4J for Android will be no longer provided. This is because the regular version got slimmed down and there is no reason to release separate binaries. You can use the regular version on the Android platform.
– Java 1.4.x no longer supported
Twitter4J 3.0.x is compatible with Java 5+. Twitter4J compatible with Java 1.4.x & Twitter API 1.1 could be provide on a request basis. If you need to stick with Java 1.4.x for some reasons, contact yusuke@mac.com.
Migrating from 2.1.x to 2.2.x
– Rebuild your project first!
Version 2.2.0 is slightly incompatible with previous versions. Projects that have been using previous versions are required to be rebuilt before using Version 2.2.0.
– migration of twitter4j.http.* package (TFJ-559)
classes in twitter4j.http.* has been migrated to twitter4j.auth.*.
– retirement of Basic authentication (TFJ-560)
TwitterFactory.getInstance(screenName,password) was retired. To get an access token using xAuth flow, use Twitter.getOAuthAccessToken(screenName, password). getOAuthAuthorizedInstance(Authorization) was retired, use getInstance(Authorization) instead.
– introduction of new artifacts for async API and streaming API (TFJ-345)
Async API has been migrated to twitter4j-async artifact (depending on twitter4j-core), Streaming API support has been migrated to twitter4j-stream artifact (depending on twitter4j-async).
– JSON store is disabled by defalt (TFJ-562)
You can get the raw json form of response from the API usingDataObjectFactory#getRawJSON(). But as of version 2.2.0, the feature is disabled by default. You can enable the feature by setting jsonStoreEnabled configuration parameter to true in twitter4j.properties.
– licensing (TFJ-446)
Note that Twitter4J is released under Apache License 2.0 from version 2.2.0.
Version 2.1
Released on 1/24/2010: Supports all existing methods. Performance and memory footprint improvements. Better Android compatiblity.
Migrating from 2.0.x to 2.1.x
– Rebuild your project first!
Version 2.1.0 is slightly incompatible with older versions. Projects that have been using older versions are required to be rebuilt before using Version 2.1.0.
– artifactId, groupId changes (TFJ-225)
artifactId has been changed from twiter4j to twitter4j-core, and groupId has been changed from net.homeip.yusuke to org.twitter4j.
– Introduction of Factory classes (TFJ-231)
Pubic constructors of Twitter, AsyncTwitter and TwitterStream are now deprecated and TwitterFactory, AsyncTwitterFactory and TwitterStreamFactory have been introduced (TFJ-231).
Twitter, AsyncTwitter and TwitterStream are now basically immutable and thread safe than ever and most of all setters have been retired.
The exception of immutableness is about OAuth’s token status. (Async)Twitter has three states. 1. no Token. 2. RequestToken acquired (set). 3. AccessToken acruired (set). Once you acruired AccessToken, you won’t be able to acruire RequestToken from the instance anymore and you’ll get IllegalStateException instead.
– AsyncTwitter / TwitterListener changes (TFJ-244,TFJ-246,TFJ-284)
AsyncTwitter is now independent from Twitter class. AsyncTwitter doesn’t have any sync methods anymore, and all async methods renamed from *Async to *. Those method now don’t take TwitterListener anymore and you will need to pass your own TwitterListener implementation to the constructor or the AsyncTwitterFactory (TFJ-284).
TwitterListener.onException(TwitterException te, int method) has been retired, and TwitterListener.onException(TwitterException te, TwitterMethod method) is now available.
Async methods that don’t take TwitterListener were all retired (TFJ-246).
– Streaming API supports deletion and track limit notices (TFJ-210)
StatusListener.onDeletionNotice(StatusDeletionNotice) and StatusListener.onTrackLimitationNotice(int) have been introduced. The method signature of StatusStream#next has been changed from Status next() to void next(StatusListener listener).
– Retirement of deprecated methods (TFJ-113,TFJ-240)
All methods marked as deprecated at version 2.0.10, and getFeatured() have been retired (removed).
– Cursor based pagenation with getFriendsStatuses() and getFollowersStatuses() (TFJ-234)
getFriendsStatuses(Paging) and getFollowersStatuses(Paging) have been retired.
Instead, you can use cursor based pagenation with getFriendsStatuses(long) and getFollowersStatuses(long).
They return PagableResponseList<twitter4j.List> which implements CursorSupport.
getFriendsStatuses() and getFollowersStatuses() (with no parameter) are handy methods which are equivalent calls to getFriendsStatuses(-1l) and getFollowersStatuses(-1l) which retrieve the first page.
Call getFriendsStatuses(previousResponse.getNextCursor()) to retrieve the next page.
– twitter4j.ResponseList instead of java.util.List
Previously, client codes using methods that returns List of TwitterResponse need to pick one element inside the list to check the rate limit status.
Now those methods returns twitter4j.ResponseList instead of java.util.List, and rate limit status is available directly through the ResponseList.
– Disambiguation of screen name and user id (TFJ-207)
User related methods that take (String id) had ambiguities about numeric-only screen names. Following methods now take (int userId) as well as (String screenName) and it is now possible to treat numeric-only screen names properly.
getUserTimeline()
showUser()
sendDirectMessage()
getFriendsStatuses()
getFollowersStatuses()
enableNotification()
disableNotification()
createBlock()
destroyBlock()
existsBlock()
createFriendShip()
destroyFriendShip()
– Rate limit status is everywhere
TwitterResponse now implements getRateLimitStatus(). getRateLimitStatus() of elements in the list returned by Twitter methods return null. Use (Pagable)ResponseList.getRateLimitStatus() instead.
Introduced with this change:
TwitterResponse.getRateLimitStatus()
Removed with this change:
TwitterResponse.getRateLimitLimit() : use RateLimitStatus.getHourlyLimit() instead.
TwitterResponse.getRateLimitRemaining() : use RateLimitStatus.getRemainingHits() instead.
TwitterResponse.getRateLimitReset() : use RateLimitStatus.getResetTime() instead.
– Introduction of GeoLoction class (TFJ-217)
GeoLocation class has been introduced. Now you can determine the existence of a geo location in a Status with null != status.getGeoLocation().
Removed with this change:
Status.getLongitude()
Status.getLatitude()
Query.setGeoCode(double latitude, double longitude, double radius, String unit)
Twitter.updateStatus(String status, double latitude, double longitude)
Twitter.updateStatus(String status, long inReplyToStatusId, double latitude, double longitude)
Introduced with this change:
twitter4j.GeoLocation
Status.getGeoLocation()
Query.setGeoCode(GeoLocation location, double radius, String unit)
Twitter.updateStatus(String status, GeoLocation location)
Twitter.updateStatus(String status, long inReplyToStatusId, GeoLocation location)
AsyncTwitter.updateStatusAsync(String status, GeoLocation location, TwitterListener listener)
AsyncTwitter.updateStatusAsync(String status, long inReplyToStatusId, GeoLocation location, TwitterListener listener)
– Method name refactors (TFJ-245,TFJ-264)
Removed with this change:
Twitter.updateDeliverlyDevice()
AsyncTwitter.updateDeliverlyDeviceAsync()
Twitter.rateLimitStatus()
AsyncTwitter.rateLimitStatus()
Introduced with this change:
Twitter.updateDeliveryDevice()
AsyncTwitter.updateDeliveryDeviceAsync()
TwitterListener.updatedDeliverlyDevice()
TwitterListener.updatedDeliveryDevice()
Twitter.getRateLimitStatus()
AsyncTwitter.getRateLimitStatus()
– TwitterResponse is not a class anymore.
Shouldn’t matter in most cases. TwitterResponse is now an interface representing just rate limit status accessors. It’s not a super class of every response objects anymore. More specifically and internally, most of response classes are extending TwitterResponseImpl from Version 2.1.0.
Version 2.0
Released on 4/9/2009: OAuth supported version. Twitpocalypse safe (from version 2.0.8)
Version 1.0
Released on 2007/06/09: initial release.