Facebook Graph API - likes returns me an empty set

前端 未结 8 549
广开言路
广开言路 2020-12-16 09:44

When I try to get all my \"likes\" (formerly fan pages) on Facebook Graph API, sometimes it returns me an empty set:

{
   \"data\": [

   ]
         


        
相关标签:
8条回答
  • 2020-12-16 10:16

    If all you need to know is whether or not a user is a fan of something (and not a list of likes or a list of fans) this should do the trick: http://developers.facebook.com/docs/reference/rest/pages.isFan.

    0 讨论(0)
  • 2020-12-16 10:21

    add user_likes permission to your application

    0 讨论(0)
  • 2020-12-16 10:23

    You can't get the likes of a fan page through the API. Follow this bug for more info: http://bugs.developers.facebook.net/show_bug.cgi?id=12880

    0 讨论(0)
  • 2020-12-16 10:23

    You cannot get likes of a post because of permission concern problem. https://developers.facebook.com/docs/graph-api/reference/v4.0/object/likes#readperms

    0 讨论(0)
  • 2020-12-16 10:26

    I read in the Changelog of 2010-12-12:

    GET [page-id]/members/[user-id] will return the individual user if he or she is a fan of the page (Graph API equivalent of pages.isFan) (rE322057)

    So, you can check with Graph API if a known user_id is fan of a known page_id with exactly this syntax. You need to supply a valid access_token. With the fields parameter you can choose, what the API should return. E.g. append "&fields=id,name,picture" to get the id, name and picture in case the user is a fan.

    {
       "data": [
          {
             "id": "712084216",
             "name": "Mike Bretz",
             "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs842.snc4/70441_712084216_5491098_q.jpg"
          }
       ]
    }
    

    You'll get an empty result if the user is not a fan

    {
       "data": [
    
       ]
    }
    
    0 讨论(0)
  • 2020-12-16 10:28

    If you are using Graph API Explorer. you can set permissions by taking get Access Token Button on the Top and specify user_likes and click ok.. Try your code again..

    Hope this helps

    0 讨论(0)
提交回复
热议问题