Facebook Graph API - likes returns me an empty set

前端 未结 8 551
广开言路
广开言路 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条回答
  •  -上瘾入骨i
    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": [
    
       ]
    }
    

提交回复
热议问题