Sacki
Sacki

Reputation: 137

Graph API: Number of Comments for Posts Are Inconsistent Among Various API Calls

Hello Graph API experts,

When you call /[post_id , the result contains "comments" field which has "count" field that is supposed to have the total number of comments for this particular post.

Now, if you call /[post_id]/comments , you get the actual comment data, one by one.

The problem I am facing is that, when I compare the "comments.count" field's value and the number of all of the actual comment data returned, they are different.

What's even worse, if you then look at the same post on Facebook.com's Timeline where you can see the number of comments for that post (i.e. "view all * comments" link), this number is also different from the "comments.count" field value.

And this is not only happening to one post, but to many of them - I observe this tend to happen more to posts with more than 100 comments (I actually counted all the comments on Timeline, and it matched the number of the actual comment data returned from /[post_id]/comments API call).

Is this a normal API behaviour? Which number should I or would you trust if this is the way it is?

Upvotes: 2

Views: 1453

Answers (3)

Christopher Thomas
Christopher Thomas

Reputation: 4702

in addition to this there are problems with pagination, you can use the offset + limit parameters to say how much data you want and from where to take it, if you deal with number of posts, you can say offset=0 and limit=50 and it'll work, but then if you try offset=100 and limit=50 it might return empty data, but then try offset=100 and limit=100 and it'll return 100 posts.

the api is just buggy and full of inconsistencies which don't seem to have any way to solve them.

I think we got oversold on the opengraph, I don't think it's what facebook told us it would be and I'm starting to feel the burn from selling that to my boss and finding out that I perhaps can't deliver :(

Upvotes: 0

FZE
FZE

Reputation: 1627

ok, when you looking some facebook comment counts on some timeline posts, you woulld see that count for ex. 16 comments, and when you try to count comments manually on the post you may see it's looking 15 comments, so where is it that missing comments ? is that a wrong count by facebook ? no not actually, it's because, some people changing profile privacies as like don't show my comments people who aren't my friends, or we haven't any mutual friends, etc. it's because you cannot get these privatized comments from graph api, but these comments aren't excluding in total count. So what's the solution, just be sure get all the data correctly what facebook provide you. And compare it, how many comments looking like missing, and show missing counts as private comments count in your application. I think is much better.

Upvotes: 3

DMCS
DMCS

Reputation: 31860

Welcome to the world of Facebook API programming. Yes, this is normal (but apparently not desired) API behavior. This is one of the inconsistencies we're faced with when programming around their API. CBroe is probably correct in his comment above, it is data inconsistencies between servers in their API cluster.

Upvotes: 2

Related Questions