使用Graph Api 2.7在一次通话中获取多个帖子的帖子洞察

Ale*_*ell 5 facebook facebook-graph-api

我正在尝试使用Facebook Graph API 2.7版获取页面提要的帖子洞察.

如果我只写:

'[Page ID]/feed?fields=insights'
Run Code Online (Sandbox Code Playgroud)

它要求指标,表明它应该工作......但是在指定指标时:

'[Page ID]/feed?fields=insights/post_impressions/lifetime' 
Run Code Online (Sandbox Code Playgroud)

我得到语法错误.

我试过了.符号为:

'[Page ID]/feed.insights/post_impressions/lifetime' 
Run Code Online (Sandbox Code Playgroud)

但是没有运气!

我知道我可以通过邮寄(单独调用API)来做到这一点,但这正是我想要避免的.

任何人都知道嵌套见解的正确语法是什么?

CBr*_*roe 19

这个错误报告能够解释一下:https://developers.facebook.com/bugs/1755454881375647/

您可以使用metric关键字指定所需的指标,如下所示:

/page-id/posts?fields=insights.metric(post_impressions,post_consumptions_unique)
Run Code Online (Sandbox Code Playgroud)

将您感兴趣的指标命名为,并用逗号分隔.

指定句点(如果适用)似乎使用相同类型的语法,

/…?fields=insights.metric(…).period(lifetime)
Run Code Online (Sandbox Code Playgroud)

(尽管一次性请求不同时期的不同时段可能无效.)