how to get share count on graph api 2.10

前端 未结 2 537
囚心锁ツ
囚心锁ツ 2021-01-21 23:37

In the previous graph api version 2.7 this was working for all count (total, like, comment):

https://graph.facebook.com/v2.7/?fields=id,share,og_object{engageme         


        
相关标签:
2条回答
  • 2021-01-22 00:40

    For all engagement share, like, comments use this query.

    https://graph.facebook.com/?fields=id,share,og_object{engagement{count},likes.summary(true).limit(0),comments.limit(0).summary(true)}&id=<url>
    

    Output:

    {
       "id": <url>,
       "share": {
          "comment_count": 0,
          "share_count": 61
       },
       "og_object": {
          "engagement": {
             "count": 61
          },
          "likes": {
             "data": [
    
             ],
             "summary": {
                "total_count": 0,
                "can_like": false,
                "has_liked": false
             }
          },
          "comments": {
             "data": [
    
             ],
             "summary": {
                "order": "chronological",
                "total_count": 0,
                "can_comment": false
             }
          },
          "id": "975365752527984"
       }
    }
    
    0 讨论(0)
  • 2021-01-22 00:41

    You can use the query

    https://graph.facebook.com?id=<your-url>&fields=og_object{engagement}
    

    The answer will be

    {
      "og_object": {
        "engagement": {
          "count": 197,
          "social_sentence": "197 people like this."
        },
        "id": "895062470590407"
      },
      "id": "<your-url>"
    }
    

    og_object->engagement->count total shares here

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