I would like to use graph API to get page and app insights without Facebook JS SDK.
I tried the following:
- I created an app with user A
- I log in to that app using the following url with user B (user B is admin of pages and apps)
- Using the above url, login was ok, I got the access token
- Using https://graph.facebook.com/me/accounts I got the list of apps and pages
- Finally I try to query insights values with the following url
https://graph.facebook.com/%5Bpage id]/insights&access_token=[login_response_access_token] but I got the following empty result:
{
“data”: [
],
“paging”: {
“previous”: “https://graph.facebook.com/%5Bpage_id%5D/insights?format=json&since=1329064393&until=1329323593”,
“next”: “https://graph.facebook.com/%5Bpage_id%5D/insights?format=json&since=1329582793&until=1329841993”
}
}
What wrong with my steps?
I tried to use Graph API Explorer and I cannot get insights values from the following url:
https://developers.facebook.com/tools/explorer
- Open above url
- Get access token (read_insights, manage_pages)
- https://graph.facebook.com/%5Bpage_id%5D/insights returns same empty JSON
your first and second steps are true but the third one is wrong because in the url https://graph.facebook.com/%5Bpage_id%5D/insight there is no insight field on the node of your page_id like everyone I think. You can see the fields you are able to use on the right side of the Graph explorer.
May be the reason of the emptiness of insights could be FB.api returns empty datas for some days nowadays. you can test it by clicking show old insights in the page of your app. you will see.