dark_shadow
dark_shadow

Reputation: 3573

How to differentiate between facebook comments and their replies returned from facebook api?

I'm trying to fetch facebook comments along with their replies and likes for each of the comment and reply but no luck so far.

On trying out following api in explorer:

/v2.4/405944472923733/feed?fields=name,comments.summary(true).filter(stream).order(reverse_chronological)

I get following response:

{
  "name": "XYZ Photos",
  "comments": {
    "data": [
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "cvnbkjcvnbvc",
        "created_time": "2015-09-12T18:54:59+0000",
        "id": "417121811805999"
      },
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "bncvvkjbncvlknbcv",
        "created_time": "2015-09-12T18:54:58+0000",
        "id": "417121718472675"
      },
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "nbkjncvvknbc",
        "created_time": "2015-09-12T18:54:57+0000",
        "id": "417121691806011"
      },
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "nlcvknbcvnb",
        "created_time": "2015-09-12T18:54:56+0000",
        "id": "417121688472678"
      },
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "nkcjbnknb",
        "created_time": "2015-09-12T18:54:55+0000",
        "id": "417121685139345"
      },
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "nbkjncvkjn",
        "created_time": "2015-09-12T18:54:54+0000",
        "id": "417121678472679"
      },
      {
        "from": {
          "name": "Rajveer Singh",
          "id": "824840727631444"
        },
        "message": "nbkjncknb",
        "created_time": "2015-09-12T18:54:50+0000",
        "id": "417121665139347"
      }
    ],
    "paging": {
      "cursors": {
        "after": "WTI5dGJXVnVkRjlqZFhKemIzSTZOREUzTVRJeE5qWTFNVE01TXpRM09qRTBOREl3T0RRd09UQT0=",
        "before": "WTI5dGJXVnVkRjlqZFhKemIzSTZOREUzTXpBM09UWTRORFUwTURVd09qRTBOREl4TkRZNU9UQT0="
      },
      "next": "nextUrl"
    },
    "summary": {
      "order": "reverse_chronological",
      "total_count": 76,
      "can_comment": true
    }
  }
}

My problem is though I'm getting all comments and replies in a single call, there is no way I can distinguish between two. Also, it doesn't give any information about likes for a given comment or reply.

How can I get these other info ?

Upvotes: 1

Views: 367

Answers (1)

daviddoran
daviddoran

Reputation: 528

Use the parent field which will only be present if the comment is a reply.

Upvotes: 1

Related Questions