Booli
Booli

Reputation: 33

Graph API, list last posts incl total likes of posts

I'm trying to make a custom-feed from my companies Facebook page to our website. I query the Graph API of Facebook to get this information.

Facebook changed the API a while ago to not include like counts in the normal page query. In the documentation it says to add summary=1 to get the total likes. My query does not return the total_count tho when I query it.

I am omitting my acces_token in the queries because I'm using the API Explorer.

Query I use to get posts:

Raafh/posts?limit=4

trying to add summary=1 does nothing with the query.

I can however do another query which will return the likes and the total count, but not the post info so I can't use it, or I have to use two queries.

Raafh/posts?fields=likes.summary(1).limit(1)

This posts the last like + the total_count.

How can I combine these two in one query?

Upvotes: 3

Views: 364

Answers (1)

You can add required fields in comma separated format to get post data like shown in example below.

Raafh/posts?fields=likes.summary(1).limit(1),id,message,from,picture,link,name,caption,description

Upvotes: 2

Related Questions