springfacebookfacebook-graph-apispring-social-facebook

Which version of spring-social-facebook fits to which Facebook Graph API version?


How can I find out, which version of spring-social-facebook uses which version of Facebook's Graph API?

Is there a chance to configure the API version in spring-social-facebook?

I'm asking this, as in the moment (31.10.2016) the newest version of spring-social-facebook is not compatible to the actual facebook API. An exception is thrown: "(#12) bio field is deprecated for versions v2.8 and higher".

In the moment I'm only developing - but I am unsure, how to avoid this kind of error in a release version. How can I make sure, that changes in facebook's API don't crush my application?


Solution

  • In order to know which Facebook’s Graph API version is implemented by a spring-social-facebook release you could see the official announcements on spring site: i.e. 2.0.0.RELEASE implements v2.3 of Facebook’s Graph API, 2.0.3.RELEASE implements v2.5, and so on.

    In v2.0.3.RELEASE of spring-social-facebook was introduced the method FacebookTemplate.setApiVersion(String apiVersion): you have the possibility to set the Facebook’s Graph API version in order to use the same one configured on your facebook app. In detail, when the getBaseGraphApiUrl() method is called the url is dinamically built with the api version provided by the setApiVersion method ("https://graph.facebook.com/v" + apiVersion + "/").

    Unfortunately, although no one forbids you to provide a Facebook’s Graph API version greater than the target version implemented by a spring-social-facebook release, you have no guarantee that everything works properly (i.e. you cannot resolve the bio field problem setting the api version with value 2.8 by setApiVersion method) then this is not a solution.

    To answer your last question, I suggest you to implement this workaround, wait the next spring announcement and use the next spring-social-facebook release when it will be fully compatible with the api version of your facebook app (v2.8 I suppose), so you'll be able to use all the api (i.e. facebook.userOperations().getUserProfile()) without errors. Moreover, your facebook app will still use v2.8 of Facebook’s Graph API (even if a new version of Facebook’s Graph API will be released) and then the spring-social-facebook release that you'll use (for example in a production env) will continue to be fully compatible with it.