Open Graph built-in actions (like video.watches or

2019-06-26 06:38发布

问题:

I am trying to get all video.watches from my friends with

https://graph.facebook.com/me/friends/video.watches?access_token=<valid_token>

My access token has both user_actions.video and friends_actions.video permissions. And I get empty result:

{
"data": []
}

While a friend of mine with id 100000291284354 has watched videos with Vevo app and when I do

https://graph.facebook.com/100000291284354/video.watches?access_token=<valid_token>

I get these videos. The same with news.reads (I can get the news if I put the friend id, while get empty result when I request via /me/friends/)

What can be wrong?

回答1:

I believe that's the correct action. Or I would want to believe so.

user_actions.video should grant me/video.watches only and friends_actions.video should grant friend_id/video.watches. A valid way to check would be to drop the friends_actions.video permission and try again with the user id you mentioned. But then why is there an end /me/friends/video.watches?

I don't think this endpoint should exist. It seems you can attach video.watches path to the end of some graph calls and it will silently fail with an empty an array as opposed to the pagination link you are given

{
  "data": [
  ], 
  "paging": {
    "next": "pagination_url"
  }
}

Try it yourself (in my case I tried it with music.listens)

  • /me/photos/music.listens - Silently fails with call to /me/photos
  • /me/likes/music.listens - Error 100
  • /me/friends/music.listens - Silently fails with empty array

The rest behave as expected with invalid path components so a second guess would be some of these paths are bugs.

So, I don't think you are able to do, what you think you can do; grab all the activity of your friends all at once.



回答2:

Facebook has enhanced there API yesterday, try this Graph API request:

GET https://graph.facebook.com/me/friends?limit=10&fields=name,video.watches.limit(2)

see https://developers.facebook.com/docs/reference/api/field_expansion/ and https://developers.facebook.com/blog/post/2012/08/30/updates-to-the-graph-api/