facebook graph api if a user has liked a page

此生再无相见时 提交于 2020-01-17 03:53:10

问题


I am trying to use facebook graph api to find out if a user has liked a particular page.This is the query I tried

https://graph.facebook.com/user_id/likes/page_id?access_token="my access token"

I tried the same kind of query to find if two users are friends but its returning empty data set even for that.

https://graph.facebook.com/user_id/frineds/user_id

How should I solve that issue?


回答1:


You can use

GET /v2.2/{user-id}/likes/{page-id}

to find out if a user likes a page. Remember that you need the user_likes permission!

See

  • https://developers.facebook.com/docs/graph-api/reference/v2.2/user/likes#readmodifiers

For seeing if a user is a friend of another user, try

GET /v2.2/{user-id-a}/friends/{user-id-b}

You need the user_friends permission to do so.

  • https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends#readmodifiers


来源:https://stackoverflow.com/questions/27309915/facebook-graph-api-if-a-user-has-liked-a-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!