Access to Facebook API using REST and HttpClient

16,432

I can't answer all your questions but the method calls are made via http://api.facebook.com/restserver.php so a call to users.getInfo looks like this

http://api.facebook.com/restserver.php?method=users.getinfo

You also need to pass in your api key and any other parameters the method needs. But rather than make the http calls yourself there must be some Java library that abstracts all this away for you.

As for this being a REST API - there's one web service endpoint with method scoping in the URL and all calls are made via HTTP GET or POST.

Frankly, this is RPC over HTTP and about as far from REST as you can get (no pun intended!). Facebook should change their API documentation, it's just plain wrong.

Share:
16,432
mw_javaguy
Author by

mw_javaguy

Updated on June 04, 2022

Comments

  • mw_javaguy
    mw_javaguy almost 2 years

    I am going to use RESTful Web Services and HttpClient to access Facebook API REST Server.

    Am somewhat of a newbie to REST and Facebook APIs...

    Question(s):

    Verification / Authorization

    (1) If I have a session key sent by a client app, how do I verify and authenticate that the user exists and then query for his / her friends on the server side?

    How can I be access these Facebook RESTful end points:

    http://wiki.developers.facebook.com/index.php/Users.getInfo

    and

    http://wiki.developers.facebook.com/index.php/Friends.getLists

    via a HTTP GET Request? Meaning, what does the full URL look like including parameters?

    (2) What would the full RESTful URL look like to grab the APIs (which I have listed above)?

    Posting to a Friend's Wall

    (3) After verification / authorization, querying users friends, how (which API) would I use to a post to a Friend's Wall?

    (4) Is there any additional parameters that I need to append to the Facebook RESTful Server's URL?

    HTTP Client

    (5) Do I include the RESTful web service calls to these Facebook APIs inside my Java program through HttpClient?

    Happy programming and thank you for taking the time to read this...