Facebook Graph API – Get ID from Facebook Page URL

It seems to me that the easiest solution to what you describe is to just get the id/name from the url you have using lastIndexOf(“https://stackoverflow.com/”) (which most languages have an equivalent for) and then get “https://graph.facebook.com/” + id. The data that this url returns has the id (i.e.: 6708787004) and the username (i.e.: southpark), so …

Read more

How to get large photo URL in one API call?

I haven’t tried this with stream/feed photos, but the generally accepted way of doing this is: http://graph.facebook.com/{ID of object}/picture If you want the “large” version, you would do: http://graph.facebook.com/{ID of object}/picture?type=large I’m not 100% sure if this would work for an actual photo (instead of a user profile picture or page profile pic), but I …

Read more

Using Facebook Graph to simply post a wall message with just javascript

Note 4/16/2011: stream.publish seems to have been deprecated, There’s a new way to do this: http://developers.facebook.com/docs/reference/dialogs/feed/ You can use something like this to publish to a wall, the user will need to confirm before it get sent. Don’t forget that you’ll need to use FB.init and include the JS SDK link. function fb_publish() { FB.ui( …

Read more

How to get Likes Count when searching Facebook Graph API with search=xxx

Couldn’t find this in the documentation but multiple calls to the API are not necessary. You can use summary when querying a feed or multiple posts. Specify this in the fields parameter. https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true) This will return a response like this. { “data”: [ { …. “summary”: { “total_count”: 56 } … }, { …. “summary”: …

Read more

Posting an embedded video link using the Facebook Graph API

It appears that you have to extract the URLs of the actual swf in the page and the thumbnail image yourself. For example, this seems to work: curl -F ‘access_token=…’ \ -F ‘message=Link to YouTube’ \ -F ‘link=http://www.youtube.com/watch?v=3aICB2mUu2k’ \ -F ‘source=http://www.youtube.com/v/3aICB2mUu2k’ \ -F ‘picture=http://img.youtube.com/vi/3aICB2mUu2k/0.jpg’ \ https://graph.facebook.com/me/feed It appears that you can generate a valid source …

Read more