I have 2 facebook pages where im admin on, lets call them page_a
and page_b
if i run this for page_a it works as expected:
HTTP GET -> {PAGE_A_ID}/insights?metric=page_fans_country
{
"data": [
{
"name": "page_fans_country",
"period": "day",
"values": [
{
"value": {
"AR": 4,
"AT": 13,
"AU": 7,
"BE": 16,
....
the page access token i use have the following scopes: read_insights
, manage_pages
, pages_show_list
and public_profile
but when i then try to query details about a post i get this
HTTP GET -> {PAGE_A_ID}_{PAGE_A_POSTID}/insights?metric=post_impressions,post_impressions_unique,post_video_views,post_video_views_unique&period=lifetime
{
"error": {
"message": "Permissions error",
"type": "OAuthException",
"code": 200,
"error_subcode": 1504029,
"is_transient": false,
"error_user_title": "User doesn't have enough permissions to load insights",
"error_user_msg": "You do not have enough permission to view the metric.",
"fbtrace_id": "..."
}
}
it works when i do the same for page_b
HTTP GET -> {PAGE_B_ID}_{PAGE_B_POSTID}/insights?metric=post_impressions,post_impressions_unique,post_video_views,post_video_views_unique&period=lifetime
{
"data": [
{
"name": "post_video_views",
"period": "lifetime",
"values": [
{
"value": 0
}
],
....
the page access token for page_b has same scopes as the one for page_a
I can see all the numbers in facebooks UI, but i cant not access it via the API, anybody had similar issues before?, im stuck and dont know where to go from here.
All above code have been ran in the Facebook Graph Explore, with newly generated tokens.
Any inputs on where to go from here are appreciated.
2
Answers
We got the same issue a couples day ago. After playing with scopes we found that if
business_management
scope is grant then we got the data. But clearly, from its documentbusiness_management
is not required for reading Page Insights. Hopefully, there is someone has better insightsAs mentioned in a comment by @xuantuan58 this seems to be a bug in the FB API.
https://developers.facebook.com/support/bugs/301627877187448/
And may also be related to this bug report: https://developers.facebook.com/support/bugs/2380273985356980/
I have noticed it is only occurring on certain users & pages but as of yet am unable to see a pattern. Sometimes an error will not be returned by the API and instead just an empty data array. If you think there should be data in the response try using the graph explorer tool as I’ve found that will sometimes give better error responses.
https://developers.facebook.com/tools/explorer/
UPDATE: This issue has now been marked as resolved by Facebook. I have been testing and found this issue has indeed been fixed.