title: Fetching Facebook Timeline posts using Facebook API
body: <p>I'm facing following issues while fetching facebook user/pages/group timeline posts:</p>
  
  <ol>
  <li>I'm not getting all information (photos urls, link, created_time, etc) in posts objects retrieved using <a href="https://developers.facebook.com/docs/graph-api/reference/v2.4/group/feed#read" rel="nofollow noreferrer">this</a>. Following is a sample response of this api:</li>
  </ol>
  
  <blockquote>
  <pre><code>[
      {
          "message": "this is going to be real fun https://localhost.com/N1AyEvZp",
          "story": "Rajveer Singh added photos to XYZ Photos in My-group.",
          "updated_time": "2015-09-03T16:27:34+0000",
          "id": "405944472923733_413853035466210"
      },
      {
          "message": "this is going to be fun https://localhost.com/EJo1WvZp",
          "story": "Rajveer Singh added photos to XYZ Photos in My-group.",
          "updated_time": "2015-09-03T16:14:41+0000",
          "id": "405944472923733_413848848799962"
      },
      {
          "message": "this is going to be some real funhttps://localhost.com/VyVKdWga",
          "story": "Rajveer Singh added photos to XYZ Photos in My-group.",
          "updated_time": "2015-09-02T15:45:08+0000",
          "id": "405944472923733_413582785493235"
      }
  ]
  </code></pre>
  </blockquote>
  
  <p>This response is missing the photo urls, links, captions, etc from the posts. Is there any different api for fetching those informations ? Also, if I directly hit the one of the post object <strong>/405944472923733_413582785493235</strong> then I get following response:</p>
  
  <blockquote>
  <pre><code>{
    "created_time": "2015-09-02T15:45:07+0000",
    "message": "this is going to be some real funhttps://localhost.com/VyVKdWga",
    "story": "Rajveer Singh added photos to XYZ Photos in My-group.",
    "id": "405944472923733_413582785493235"
  }
  </code></pre>
  </blockquote>
  
  <p>Though I get <em>created_time</em> in this response but <em>pictures, urls,</em> are still missing. I found <a href="https://developers.facebook.com/docs/graph-api/reference/v2.4/post" rel="nofollow noreferrer">this</a> api deprecated. <strong>Is there any different api which can give me all the info ?</strong></p>
  
  <ol start="2">
  <li>The above response is also missing comments and replies. On google search I found that we can get comments using <strong>/405944472923733_413582785493235/comments</strong> api but again that api doesn't mention the <em>exact comments count</em>. <em>Also, the api doesn't give all the comments in a single api call</em>. They have a pagination kind of thing. <strong>Can anyone tell me how can I get exact count of comments, replies to comments, and retrieve all the comments in a single api call</strong>. If we can't retrieve all the comments in a single go, then <strong>how can we use pagination</strong> ? I need to send all the comments related to a post to my front-end. with pagination, how can I achieve that ? <strong>Do I need to store the previous/next urls somewhere in front-end ?</strong> Following is a sample response of this:</li>
  </ol>
  
  <blockquote>
  <pre><code>{
      "data": [
          {
              "id": "[post_id]",
              "from": {
                  "name": "[name]",
                  "id": "[id]"
               },
               "message": "[message]",
               "created_time": "2011-01-23T02:36:23+0000"
          },
          {
               "id": "[id]",
               "from": {
               "name": "[name]",
                   "id": "[id]"
               },
              "message": "[message]",
              "created_time": "2011-01-23T05:16:56+0000"
          }
      ],
    "paging": {
      "cursors": {
        "after": "WTI5dGJXVnVkRjlqZFhKemIzSTZOREUzTVRJeE5qWTRORGN5Tmpnd09qRTBOREl3T0RRd09URT0=",
        "before": "WTI5dGJXVnVkRjlqZFhKemIzSTZOREUzTVRFNU16RTRORGN5T1RFMU9qRTBOREl3T0RRd05qZz0="
      },
      "previous": "previousUrl",
      "next": "nextUrl"
  }
  </code></pre>
  </blockquote>
  
  <ol start="3">
  <li>How to get <em>count of all the likes and shares</em> of a post ? I simply want the count and doesn't want who actually likes/shared the post. How can I get that ? I found that using <strong>/likes</strong> gives a list of all those who liked the post but it doesn't give the count. Following is a sampple response of that:</li>
  </ol>
  
  <blockquote>
  <pre><code>{
    "data": [
      {
        "id": "824565440992306"
      }
    ],
    "paging": {
      "cursors": {
        "after": "ODI0NTY1NDQwOTkyMzA2",
        "before": "ODI0NTY1NDQwOTkyMzA2"
      }
    }
  }
  </code></pre>
  </blockquote>
  
  <p><em>General Information:</em></p>
  
  <ul>
  <li>I'm using Node.js Javascript SDK for hitting FB APIs. </li>
  <li>I'm using correct access token, so that's not an issue for sure.</li>
  <li>I have gone through <a href="https://stackoverflow.com/questions/15619742/how-to-get-public-wall-posts-with-the-facebook-api">this</a> and <a href="https://stackoverflow.com/questions/4791951/retrieve-facebook-post-comments-using-graph-api">this</a> but didn't get any help from them.</li>
  </ul>
  
  <p>I need all the information related to wall posts on my back-end so that I can send all data to my front-end for proper rendering. This is a screenshot of my front-end and all the information which I need in front-end.</p>
  
  <p><a href="https://i.stack.imgur.com/svDKZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/svDKZ.png" alt="enter image description here"></a></p>
  
  <p>Can anyone please try to clear my doubts ?</p>
  
  <p>Also, if there is any optimized way of fetching all this information, then please do suggest. Your suggestions are welcome.</p>