Search code examples
androidfacebookfacebook-graph-apifacebook-likefacebook-fql

How to get all objects i.e posts on a page liked by a particular user i.e. 'me' with facebook open graph api?


I need to show all the posts/images from a particular facebook page that has been liked by the user. Now, the problem is I don't want to write nested requests for the graph response. This query returns the summary of the likes and it has a field that shows whether a user likes a particular object or not. Is there any way I can access this particular field?

My graph query is : {facebook-page-id}/posts?fields=full_picture,id,likes.limit(0).summary(true).

This gives data like this :

{
  "data": [
    {
      "full_picture": "...",
      "id": "462768487218398_522641711231075",
      "likes": {
        "data": [
        ],
        "summary": {
          "total_count": 6600,
          "can_like": true,
          "has_liked": false
        }
      }
    },
    {
      "full_picture": "https://fbcdn-sphotos-a-...",
      "id": "462768487218398_522640531231193",
      "likes": {
        "data": [
        ],
        "summary": {
          "total_count": 8860,
          "can_like": true,
          "has_liked": false
        }
      }
    }

I need to access the "has_liked" field from the query so that when the data returns, it is already filtered according to the likes of the user.


Solution

  • There is currently no way to let the Graph API filter for you on the server side unfortunately. You'll have to do this on your client.