user1098965
user1098965

Reputation:

Facebook API get number of posts?

Given a page access token, how can get the total number of posts day by day?

Upvotes: 1

Views: 3972

Answers (2)

Riley Blair
Riley Blair

Reputation: 61

You can only retrieve a summary/count for published posts on a page. Something like this will work when querying the Page directly:

{PAGE}?fields=published_posts.limit(1).summary(total_count).since(1)

The response will look something like:

{
    published_posts: {
        summary: {
            total_count: 12345
        },
        ...
    }
}

or if you want to query the published_posts directly, use:

{PAGE}/published_posts?limit=1&summary=total_count&since=1

The response will look something like:

{
    summary: {
        total_count: 12345
    },
    ...
}

Setting limit to 1 ensures that your query is not unnecessarily large. If you're just needing the total post count, then set limit to 1.

The since parameter is a unix timestamp (milliseconds since January 1, 1970) and is required to retrieve the total post count. Set this to 1 as setting it to 0 will throw an error.

More details: https://developers.facebook.com/docs/graph-api/reference/page/published_posts/

Upvotes: 1

DMCS
DMCS

Reputation: 31860

You can query the FQL insights table: http://developers.facebook.com/docs/reference/fql/insights/

the insight you're looking for in in the Page Content section of that link.

However, that is an insight that is being deprecate on 2/15. So be sure to get your data quick. It's being removed from Facebook. I don't know why.

Upvotes: 1

Related Questions