top of page


Public·32 members
Isaiah Kelly
Isaiah Kelly

Facebook Graph Like Api

Removing 'count' from 'comments' Graph API connection We are removing the undocumented 'count' field on the 'comments' connection in the Graph API. Please request id/comments?summary=true explicitly if you would like the summary field which contains the count (now called 'total_count')

Facebook Graph Like Api

I'm developing an app for Facebook in PHP, part of which lists the user's "likes". I would like to add a link next to each like so that the user can manage their likes by deleting them where they see fit.

To find out what the current user has liked (so you can delete them appropriately), you can use the "likes" connection of the User object (docs). So, if you request , you'll get a list of pages/people/whatever that a user has liked. (Note: this does not include posts or photos or things like that)

It's not the 'like' that has an ID, it's the post - which is why the api call uses '/POST_ID/likes' as a target - if you delete '/POST_ID', it'll get rid of the post, but if you delete '/POST_ID/likes' it'll get rid of the user's 'like' for that post.

Edit: I think this also may be a terminology issue, as what the doc says doesn't have ID's is probably likes to a user post, and these probably don't really have an ID and can be removed by issuing a delete to the POST_ID/likes. Then there's the likes generated by liking pages and/or external websites via the like-button, and these DO have an ID. Confusing, it is.

And I get an HTTP error 500 accompanied by "Invalid post_id parameter" in the JSON response body. Looks like the /likes resource is suited to liking a wall post and not a page. How do I get this to work with a page?

Facebook has announced support for liking URL's outside of Facebook by using the official built-in Like action. You need to have publish_actions permissions. The graph url for this is: [User FB ID]/og.likes?object=OG_OBJECT_URL&access_token=USER_ACCESS_TOKEN

If you want this functionality in a page tab or canvas page within facebook (say to allow for liking the page from within a likegated page), a work around you can involves what Tom Wells suggested in his reply to Luke. You first embed the iframe version of their like button on your page, and then simply listen for the edge.create event in your JS like so:

I believe this is not allowed except for specific partner sites, like yelp. The reason is security, you would be able to put some javascript on a page and have everyone that visits that page "Like"ing it without their knowledge.

The graph api commands /likes and /comments used on their own return a set of data with the info on who likes or commented on a post BUT the same commands also post a like or a comment against the posting if you add an NSMutableDictionary into the call to the graph api as params.

You will have already obtained the post id when you obtained the newsfeed.This works fine so long as your app has the normal permission to post. There are lots of confusing posts about likes out there. Hopefully this is not one of them.

Note: as of Nov 17, 2016 we changed the behavior of publishing likes and only support this action with Page Access Tokens.This means you can publish likes onbehave of pages only and this is worthless.

A conceptually easy way to do this would be to get the list of likes on a post and the list of likes on a page and then compare them. However, there is no functionality in Facebook that gets the list of likes on a page as of now. We will use the reverse process to check whether each like on a post likes the page as well.

The next step is to get the list of likes for a particular post and find out whether the users likes the page too. The following call gives us the list of likes for a post, provided we have proper access.

Akshit Khurana, on Quora, discusses another approach to this through the use of Facebook Query Language (FQL). FQL is an SQL-like language that lets you query the data that you receive through the Graph API. There is a list of tables, each with its own list of columns that can be queried, thus helping you filter your data.

Back years ago I used the Facebook Graph API to gather users friend photos and likes for those photos. However, that was back when the API was v2.11 or v4 or something like that. Now at version 12, my code no longer works. I've tried getting the same data I once did back using their Graph API but I have no success in doing so.

API stands for Application Programming Interface. Put in simple words API helps us connect with an external system, like a web portal or an operating system & consume/write data to & fro from it.All the big social networks like Twitter, Facebook etc. expose their data to the developer community via their APIs.

There is only so much features a single entity like Facebook can develop for their portal. APIs extend the functionality of the product or the portal by enabling the third-party developers write specific functionalities they want to.

There are several SDKs, like many, offered by Facebook for different platforms & programming languages. For instance, Facebook SDK for Android, IOS, JavaScript, PC Games, PHP, React, Swift, Unity, a business SDK. An SDK for writing apps for television. Cool stuff!!

There are also other third-party SDKs which are developed by the active community of developers building applications with Facebook. A couple of examples are Spring Social for Java, FBgraph for NodeJs, Windows SDK for Facebook by Microsoft.

Fields reference specific properties of a Graph object. So a page object will have an ID, name and description among other things. You can specify which fields you'd like to be returned for a particular node using the fields modifier.

Data on Facebook is very relational. A page for example could have many timeline posts associated with it. This relation between two Graph objects is called an edge. We can grab the page timeline posts from a page with an ID of 1337 like so:

The /me/photos endpoint could be expressed as a nested request: /me?fields=photos. That doesn't seem to be too useful until we want to also pull in another edge. For example, the pages that the user likes from the /me/likes endpoint (edge). Then it makes sense to pull in the users photos & likes with the following nested request:

When the SDK JS file successfully loads, it will look for a global function called fbAsyncInit (i.e. a function called fbAsyncInit attached to the window object), so define that function before the code snippet above. It should look like this:

Note the FB.ui call that will now occur after the user clicks on the button. The first argument of FB.ui is an object of properties to define what we want the SDK to do. We pass in a method, which is to share in this case. You also pass it an href, which in this case is the URL of the page the user is currently on. You could easily set that to a static URL as well, if you like. This FB.ui call will open the Facebook sharing dialog in a popup window and allow the user to choose how they want to share your page.

The button above will be unstyled before the SDK loads, which you may not like. Facebook provides another method of including a login button on your site that supports a sort of loading indicator before the SDK loads:

We discussed above that the first argument of FB.login is a callback function that will be called after the user interacts with the login popup. The second argument that FB.login accepts is a set of properties. Probably the most important is the scope property, as this is where you define what permissions you would like the user to approve for your app. The list of possible permissions is available in the documentation. Note that most permissions you request from users require app review by Facebook before you can actually request them live on your website. The review process can be laborsome and confusing, so be prepared. It often requires detailed explanation of why you are requesting the permission and even a screen recording of exactly how you are using it on your site.

The current Facebook Platform was launched in 2010.[2] The platform offers a set of programming interfaces and tools which enable developers to integrate with the open "social graph" of personal relations and other things like songs, places, and Facebook pages. Applications on, external websites, and devices are all allowed to access the graph.

The Graph API is the core of Facebook Platform, enabling developers to read from and write data into Facebook. The Graph API presents a simple, consistent view of the Facebook social graph, uniformly representing objects in the graph (e.g., people, photos, events, and pages) and the connections between them (e.g., friend relationships, shared content, and photo tags).[22]

Facebook Connect,[24] also called Log in with Facebook, like OpenID, is a set of authentication APIs from Facebook that developers can use to help their users connect and share with such users' Facebook friends (on and off Facebook) and increase engagement for their website or application. When so used, Facebook members can log on to third-party websites, applications, mobile devices and gaming systems with their Facebook identity and, while logged in, can connect with friends via these media and post information and updates to their Facebook profile.

The Open Graph protocol enables developers to integrate their pages into Facebook's global mapping/tracking tool Social Graph. These pages gain the functionality of other graph objects including profile links and stream updates for connected users.[29] OpenGraph tags in HTML5 might look like this:

In 2011, The Guardian expressed concerns that users publishing content through a third party provider are exposed to losing their web positioning if their service is removed; and the open graph could force connecting web presence to Facebook social services even for people using their own publishing channels.[37] In June 2018, The New York Times criticized Facebook's partnerships with device manufacturers, writing that the data available to these manufacturers "raise concerns about the company's privacy protections and compliance with a 2011 consent decree with the Federal Trade Commission."[21]


Welcome to the group! You can connect with other members, ge...


Group Page: Groups_SingleGroup
bottom of page