This is how the Graph API works. Take a look at the API docs. You get 25 pieces and must go through them. You can use the timestamp (created_time) of the last comment in the package as a parameter in the next chart API call, or you can use the offset parameter. This is what I did. created_time I came across some envy. This is an example of my C # test application. Ignore the references to the PostComment object, which is just the data structure that I created to store the data that I pull. The magic (and the process I'm referring to) is in the parameters passed to the chart API call:
parameters.Add("offset", numPostComments); parameters.Add("limit", 25);
I'm sure you can set a "limit" to something 25 or lower.
do { foreach (var comment in comments.data) { numPostComments++; PostComment pc = new PostComment(); pc.Post_ID = p.Id; pc.Facebook_ID = comment.id; pc.From = comment.from.name; if (comment.likes != null) pc.Likes = (int)comment.likes; pc.CommentDate = DateTime.Parse(comment.created_time); pc.CommentText = comment.message; p.Comments.Add(pc); } // Create new Parameters object for call to API Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("offset", numPostComments); parameters.Add("limit", 25); // Call the API to get the next block of 25 comments = client.Get(string.Format("{0}/comments", p.Facebook_ID), parameters); } while (comments.data.Count > 0);
Jay stevens
source share