Reputation: 43
When I access this resource:
https://graph.facebook.com/xxx_yyy/insights
I get this response:
{
"data": [
],
"paging": {
"previous": "https://graph.facebook.com/xxx_yyy/insights?format=json&since=-86400&until=0",
"next": "https://graph.facebook.com/xxx_yyy/insights?format=json&since=0&until=86400"
}
}
The insights data is empty. "xxx_yyy" is a valid post id I got from the feed.
What's causing the API to return an empty insights array?
Upvotes: 4
Views: 2090
Reputation: 2205
Invalid ID is a key. xxx_yyy in the question means ID must be a combination of appID (xxx part) and postID (yyy part).
So, here is the right Url for post-related metrics:
https://graph.facebook.com/[appID]_[postID]/insights
Upvotes: 2
Reputation: 11
You must use PAGE token not USER token.
then run expr. https://graph.facebook.com/xxx_yyy/insights?access_token=PAGETOKEN
Upvotes: 1
Reputation: 899
There are a few requirements for you to get data back from the Facebook Insights graph API call. These don't appear to be clearly documented anywhere, but this is what I have found by trial and error.
The post must be quite old, I was able to dig up something on one of their Ads FAQs that post insights won't be available for 12-15 hours after the end of the day they were posted on.
"Page post metrics will be available 12 to 15 hours after the end of the day the post was made. Metrics are logged on Pacific Standard Time." Page Post Metrics FAQ -Ads and Business Solutions
FB documentation on page post insights is available primarily in this Facebook blog post
Upvotes: 5