tags:

views:

3416

answers:

4

Hi there!

I should have asked this in Facebook developer forum instead, but somehow I can't register to the forum and the Facebook connect feature is not working at the time I'm writing this.

Anyway, I am still confused whether to use Graph API or the old REST API for my Facebook app. Generally, this is what I want to achieve in my app:

  1. Get profile picture and name of the user.
  2. Get profile picture and name of the user's friends who are also using my app.
  3. Post into the user's stream.
  4. Allow users to invite their friends to use the application.

Can someone provide me an insight, which one is better for my application?

+2  A: 

Use the Graph API as it incorporates everything that the old REST API had. Plus The new API is RESTful, and results are returned in JSON which is good!

jini
Plus - more friendly TOS; Minus - extended permissions request for any new kind data ;-)
zerkms
+3  A: 
  1. Get profile picture and name of the user.
    • http://graph.facebook.com/[uid] for the name and http://graph.facebook.com/[uid]/picture is an always up-to-date link to the current picture. Also, if you have an access_token, you can query http://graph.facebook.com/me for data on the current user, whoever that is.
  2. Get profile picture and name of the user's friends who are also using my app.
    • Not sure about how to get the specific friends only, maybe using FQL. However, note that you can get specific fields in the friends list (defaults to just name and id) by adding a fields parameter: .../friends?fields=id,name,picture
  3. Post into the user's stream.
  4. Allow users to invite their friends to use the application.
    • Sorry, not sure on this one...
Renesis
Looks good. For point number 4, I think I can achieve that using FBML widget. Thanks !
Andree
Where did you find this in the documentation? I was wondering if its possible to get the friends list sorted on a particular field.
Luke
+4  A: 

As Renesis said, the Graph API covers exactly what you need for the first three steps.

For the fourth point, I've been looking at the API extensively for my own apps and have found out how to do it via FBML with the following code:

<fb:serverFbml>
<script type="text/fbml">
<fb:fbml>
    <fb:request-form
        method='POST'
        type='join my Smiley group'
        content='Would you like to join my Smiley group? 
            <fb:req-choice url="http://apps.facebook.com/smiley/yes.php" 
                label="Yes" />'
            <fb:req-choice url="http://apps.facebook.com/smiley/no.php" 
                label="No" />'
        <fb:multi-friend-selector 
            actiontext="Invite your friends to join your Smiley group.">
    </fb:request-form>
</fb:fbml>
</script>
</fb:serverFbml>

http://developers.facebook.com/docs/guides/canvas/#requests

It seems as though Scott's incorrect when he says Graph incorporates everything the old REST API has:

"We are currently in the process upgrading our core server API from the old REST API to the more modern Graph API. However, most of the methods required for canvas applications to integrate with Facebook have not yet been upgraded to the new API. For the time being, we recommend you continue using the old REST API in canvas apps instead of the new APIs for the sake of completeness."

(I can only post one hyperlink, so it's the same one as the #requests hyperlink but in the 'Making API calls' section)

Not sure if this is the case with other methods of integration such as web or desktop apps, but so far it seems as though the Graph API has a little bit of catching up to do!

Edit:

To list the profile pictures of a user's friend, use the following:

Assuming you've already got the current user's ID

https://graph.facebook.com/**USER-ID**/friends?fields=picture,name&amp;access_token=**ACCESS-TOKEN**

This will provide a JSON object with a list of the current user's friends containing the UID, name and a link to the small version of the profile picture.

I haven't found a way to retrieve the large picture version in a search yet so with that method, if you wanted the large version, you'd have to iterate through each user and use this:

https://graph.facebook.com/**USER-ID**/picture?type=large
dynamism
However, I still doesn't find any way to accomplish requirement 2 in graph API (users.getAppUser). Do you have any suggestion? Currently, I'm using the legacy API for this function, and graph API for the others.
Andree
I can't format comments nicely, I'm not clever enough. Will edit the answer
dynamism
A: 

Hello,

how do I change a note with the new Graph API?

In the old REST API this is done through

https://api.facebook.com/method/notes.edit

but I can't find a way to accomplish that with the new Graph API.

Thanks in advance for any idea on that Andreas

Andreas Breitschopp

related questions