Facebook GRAPH API的GET请求中缺少结果字段 [英] Missing result field in GET requests of the Facebook GRAPH API

查看:111
本文介绍了Facebook GRAPH API的GET请求中缺少结果字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问给定网址在Facebook上收到的喜好,分享和评论数量。

I'm trying to access the number of likes, shares and comments a given URL has received on facebook.

据了解这件作品的文档,以下网址应该给我我想要的。

As I understand this piece of doc, the following URL should give me what I want.

https://graph.facebook.com/v2.4?id=http://stackoverflow.com&fields=og_object,share&access_token=MY_ACCESS_TOKEN

它给了我以下内容:

{
"og_object": {
   "id": "10150180465825637",
   "description": "Q&A for professional and enthusiast programmers",
   "title": "Stack Overflow",
   "type": "website",
   "updated_time": "2015-08-02T04:03:47+0000",
   "url": "http://stackoverflow.com/"
},
"share": {
   "comment_count": 4,
   "share_count": 32567
},
"id": "http://stackoverflow.com"
}

其中包括comment_count = 4和share_count = 32567.

which includes comment_count = 4 and share_count = 32567.

但是,如果我参考以前链接的文档,喜欢的人数应该出现在og_object:应该有一个参与线,里面有两个元素, count (喜欢的数量)和 social_sentence (一个社会语句,如你和31,608,561其他这样的人。)

But, if I refer to the previously linked piece of doc, the number of likes should appear in "og_object" : there should be an engagement line with two elements inside, count (the number of likes) and social_sentence (a social sentence such as "You and 31,608,561 others like this.")

显然,这些参与计数元素不存在。如何让他们出现?

Obviously, these engagement and count elements are not there. How can I have them appear ?

注意:在第一个URL ,我尝试更改& fields = og_object,share 部分:

NB : in the first URL, I tried changing the &fields=og_object,share part for any of these :

&fields=og_object.engagement,share
&fields=og_object.engagement.count,share
&fields=og_object,engagement,share
&fields=og_object,engagement,share
&fields=engagement,share
&fields=engagement.count,share
&fields=engagement,count,share
&fields=count,share

(NB : I also tried by putting `share` first in the list)

但没有一个工作,我总是收到一个这样的错误(每次尝试包括一个):

but none of them worked, I always get an error such as this one (every try which include a .) :

{
   "error": {
      "message": "Syntax error \"Expected \"(\" instead of \",\".\" at character 20: og_object.engagement,share",
      "type": "OAuthException",
      "code": 2500
   }
}

或这一个(每次尝试没有code>。

or this one (every try without a . :

{
   "error": {
      "message": "(#100) Tried accessing nonexisting field (engagement) on node type (URL)",
      "type": "OAuthException",
      "code": 100
   }
}


推荐答案

感谢@WizKid,答案是

Thanks to @WizKid, the answer is

https://graph.facebook.com/v2.4?id=http://stackoverflow.com&fields=og_object{engagement},share&access_token=

https://graph.facebook.com/v2.4?id=http://stackoverflow.com&fields=og_object{engagement{count}},share&access_token=

但是, og_object {engagement {count}} share_count 显示相同的号码...等于 total_count 旧(&不推荐)

However, og_object{engagement{count}} and share_count display the same number... which is equal to the total_count when using the good old (& deprecated)

http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=h‌​ttp://stackoverflow.com/

似乎没有办法得到喜欢的数量和图表的数量api ...

It seems there is no way to get the number of likes and the number of shares with the graph api...

这篇关于Facebook GRAPH API的GET请求中缺少结果字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆