Because we have a lot of API changes from version 1.x to 2.0 RestFB provides a migration guide, where the breaking changes can be found
- RC2
User.Work
->WorkExperience
FacebookPermissions
interface is the only enum now, all permission are part of it.LegacyFacebookClient
removedDefaultLegacyFacebookClient
removed
- RC1
- Logging changed,
slf4j
is used if present Comment.Attachment
->StoryAttachment
Comment.isCanComment
->Comment.getCanComment
Comment.isCanHide
->Comment.getCanHide
FeedPostValue.isHidden
->FeedPostValue.getIsHidden
Message.isRenderAsSticker
->Message.getRenderAsSticker
FacebookClient.executeQuery()
->FacebookClient.executeFqlQuery()
FacebookClient.executeMultiquery()
->FacebookClient.executeFqlMultiquery()
User.Picture
->ProfilePictureSource
Event.getPicture()
return typeString
->Event.getPicture()
return typeProfilePictureSource
Event.getVenue()
return typeVenue
-> returnsLocation
nowGroup.getVenue()
return typeVenue
-> returnsLocation
nowCheckin.Place
replaced withPlace
type.Post.Place
replaced withPlace
type.Post.Likes
replaced withLikes
type.Post.Comments
replaced withComments
type.Post.Privacy
replaced withPrivacy
type.Photo.getComments
returnsComments
type instead of `Comment list- json API changed, you should look here
Post.MessageTag
replaced withMessageTag
typeLikes
data type moved fromNamedFacebookType
toLikeItem
likes
field changed fromlong
toLikes
inPage
typelikesCount
field added toPage
type
- Logging changed,
As soon as the slf4j
jars are found on the classpath, slf4j is used
as logging framework. As fallback we use the java.util.logging
framework. In the rare case you have slf4j
on the classpath, but you
don't want RestFB to use it, you can switch to the java.util.logging
with
the system.property "com.restfb.forceJUL=true
".
Don't forget to add a RestFB logging configuration to your logging config.
We have removed the Comment.Attachment
type because it is replaced by
a newer type called StoryAttachment
. StoryAttachment
has the same
fields as Comment.Attachment
but contains the target field, too.
Therefore it is better suitable to the original Facebook JSON.
Facebook returns for Graph API 2.4+ only requested fields. So some fields are
not set. Because boolean
is only true
or false
it is changed to Boolean. So
a field can be null
if it is not set. A developer needs to check for null now,
but get better results if a field was not requested and not tricked by the Java
default value for boolean
.
The FacebookClient
interface does not longer provide the executeQuery
and
executeMultiquery
access to FQL. These methods are not longer working on the
Facebook side, so we don't need to support them further.
The DefaultFacebookClient
does not longer contain these methods. Because some
developer still use the FQL interface (Graph API 2.0) they have to switch to the
newer (and working) executeFqlQuery
and executeFqlMultiquery
.
We had to remove the User.Picture
type because we drop the
compatibility. The picture field is now the ProfilePictureSource
type.
The Event.getPicture()
returned the image url as String
. We changed this because
Facebook provides more information than only a String
. The ProfilePictureSource
is
a better choice.
The Group
and the Event
type contain a venue but this is the same type as Location
.
So we replaced it and don't need to take care of two different java entities.
We have some types that are only left, because we didn't want the break the API before version 2.0. With the new major release we can remove them and do some cleanup.
Checkin.Place
replaced withPlace
type.Post.Place
replaced withPlace
type.Post.Likes
replaced withLikes
type.Post.Comments
replaced withComments
type.Post.Privacy
replaced withPrivacy
type.`
Because the comments of a photo not only contains the comments we have to change the returned type. Now you may access the summary object and fetch the total count.
The Json.org parser is not as free as it should be and so we replaced it with the minimal-json parser. It's published under the MIT license and provides a much better performance. The minimal json benchmarks are very promising and our own benchmarks in the restfb benchmark project support their statements. Because minimal json has a different API you have to change your code accordingly. To understand the API better, you should have a look at the github repository of minimal json.
The Post
object contains some inner classes. We removed the inner class MessageTag
and replaced
it with the MessageTag
class we introduced already. The inner class was only for compatibility reasons there.
If you work with MessageTags you have to change your import.
The Likes
type contains a list of NamedFacebookTypes. These elements are in some cases not the correct type.
So we changed the type and introduces the new LikeItem
type. The new LikeItem
type contains the created_time
field.
Most of the time this value is not set, but we provide it nevertheless.
With Graph API 2.6 the likes
field does not contain the count of the likes. Instead it is
filled with the a list of likes. Therefore the returned type is Likes
. Because in earlier
versions we should be able to access the field as long, we use the duplicate mapping magic and
renamed the old likes
field to likesCount
. This is similar to the fanCount
that was introduced
with Graph API 2.6 for the Page
object.
The Graph API defines a WorkExperience
type that is used in the work
field of the User
object.
We had a custom inner class called work and this is no longer necessary.
In older RestFB versions the permissions were splitted into different classes according to their category. Facebook has several categories and a permission is connected to just one of them. The main categories are "user data" and "events, groups and pages". Now the permissions can be found in one class and the category is part of the permission. With this change it is much easier to find a permission and work with them.
The old FacebookClient was used for accessing the Facebook Rest API. This API is deprecated and removed
with the deprecation of the Graph API 2.0. The calls lead only to an error. So we removed the
stuff that is related to the Rest API. Mainly the LegacyFacebookClient
and its implementation
(DefaultLegacyFacebookClient
) are removed. Additionally the exception generator was cleaned up, because
here the legacy stuff is not needed anymore. With this change the error handling of the Batch processing
is changed a bit, but should not disturb currently working installations.