Facebook Graph API V2.0

37 views
Skip to first unread message

Dana Kianfar

unread,
May 12, 2014, 3:17:13 PM5/12/14
to bat...@googlegroups.com
Hi,

It seems like an easy fix to add support for Facebook API v2.0. All changes need to be made on the FacebookBatcher class as far as I can see. Since the library doesn't provide any Java POJOs, the only change necessary is to add a suffix "v2.0/" to the GRAPH_ENDPOINT string.

Perhaps the constructor can add an additional parameter:

public FacebookBatcher(String accessToken, int apiVersion) {
       // ...
}

The two places where the GRAPH_ENDPOINT string is used: Batch.createFetcher() and FacebookBatcher.getAccessToken(). So replacing the public static final variable GRAPH_ENDPOINT with a getter method in FacebookBatcher would be an easy fix. 

Thanks!

Jeff Schnitzer

unread,
May 12, 2014, 4:51:41 PM5/12/14
to bat...@googlegroups.com
Oh hey, how about that. Guess I missed the announcement.

I'll add the constructor parameter tonight and release a new version. Note that apiVersion will have to be a String.

Jeff


--
You received this message because you are subscribed to the Google Groups "BatchFB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to batchfb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dana Kianfar

unread,
May 13, 2014, 5:52:04 AM5/13/14
to bat...@googlegroups.com, je...@infohazard.org
Thanks for the quick updates Jeff!

Jeff Schnitzer

unread,
May 13, 2014, 2:30:21 PM5/13/14
to bat...@googlegroups.com
This is in git right now. Check it out, make sure it's what you want, and I'll push it to maven central.

Jeff

Jeff Schnitzer

unread,
May 13, 2014, 2:31:43 PM5/13/14
to bat...@googlegroups.com
I left the getAccessToken() method as-is (unversioned). AFAICT versioning on that method shouldn't have any effect. Let me know if I'm wrong though :)

Jeff

Dana Kianfar

unread,
May 14, 2014, 2:10:59 PM5/14/14
to bat...@googlegroups.com, je...@infohazard.org
Looks great! Just one suggestion for the documentation of the FacebookBatcher constructor though: The example of graph api v2 should be "v2.0/" and not "v2.0". I think the backslash in the end is necessary!

Otherwise it works for me. I agree about the getAccessToken(), I didn't know that it's unversioned but it seems that you're right!

Jeff Schnitzer

unread,
May 14, 2014, 2:20:37 PM5/14/14
to bat...@googlegroups.com
We already append a '/', so the code definitely expects "v2.0" and not "v2.0/" - although the consequence will just be an extra '/' which likely won't hurt.

I will push out 2.1.5 to maven central later today.

Jeff

Dana Kianfar

unread,
May 15, 2014, 6:00:25 AM5/15/14
to bat...@googlegroups.com, je...@infohazard.org
Oh didn't notice that. Thanks a lot for the quick updates!

Jeff Schnitzer

unread,
May 15, 2014, 6:25:59 PM5/15/14
to bat...@googlegroups.com
v2.1.5 is now in maven central.

Cheers,
Jeff
Reply all
Reply to author
Forward
0 new messages