fmaste
fmaste

Reputation: 383

Using Facebook API on an Java App OUTSIDE Facebook

I want to access Facebook info from a Java Application that is not intended to run on Facebook. I just want to be able to get and delete comments on a desktop Application but I don't know where to start.

The Facebook developers page says something about a REST API, but all the examples on the documentation are written on PHP. Also, there is a lot of information about Facebook Connect, but that seems to be only useful for applications that want to show Facebook widgets.

I just want to get direct access to the info, posts, comments, etc, ...

Is there a REST API to access Facebook ? Wheres the documentation/examples/tutorial/etc?

Somebody knows where to start, some good documentation/tutorial, etc. Somebody to point me on the right direction please.

Thanks!!

Upvotes: 2

Views: 4262

Answers (3)

vici
vici

Reputation: 326

You can easily use scribe : https://github.com/fernandezpablo85/scribe-java. It has a neat approach. It looks like :

interface FACEBOOK {
static final String APP_ID = "xxxxxxx";
static final String API_KEY = "xxxxxxx";
static final String APP_SECRET = "xxxxxxx";
static final String ACCESS_TOKEN = "xxxxxxx";
static final String PROTECTED_RESOURCE_URL = "https://graph.facebook.com/PROFILE ID/feed";}

OAuthService facebookService = new ServiceBuilder().provider(FacebookApi.class).apiKey(FACEBOOK.API_KEY).apiSecret(FACEBOOK.APP_SECRET).build();
    OAuthRequest facebookRequest = new OAuthRequest(Verb.POST, FACEBOOK.PROTECTED_RESOURCE_URL);
    Token facebookAccessToken = new Token(FACEBOOK.ACCESS_TOKEN, FACEBOOK.APP_SECRET);
    facebookRequest.addQuerystringParameter("message", status);
    facebookService.signRequest( facebookAccessToken , facebookRequest);
    facebookRequest.send();

Upvotes: 0

bizrad6
bizrad6

Reputation: 11

The new REST API documentation can be found here: http://developers.facebook.com/docs/reference/api/

If you're interested in a Java library which uses this REST API see RestFB here: http://restfb.com/

Upvotes: 1

Nate
Nate

Reputation: 2456

Java Facebook API: http://code.google.com/p/facebook-java-api/

Upvotes: 1

Related Questions