通过单个API调用获取具有见解的帖子-Facebook Graph API [英] Get posts with insights from a single API call - Facebook Graph API

查看:68
本文介绍了通过单个API调用获取具有见解的帖子-Facebook Graph API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以通过一个API调用来获取最近的10篇帖子,其中包含他们的一些见解(反应,作用范围,视图等).

I'm wondering if there's a way to get recent 10 posts with some of their insights (reactions, reach, views ..etc) from a single API call.

目前我正在做的是获取最近的10条帖子,并遍历其ID以获取他们的见解.但这减慢了请求的速度.

Currently what I'm doing is getting recent 10 posts and looping through their IDs to get their insights. But this slows down the request.

我希望得到这样的答复

{
  "posts": {
    "data": [
      {
        "story": "Cyborgs shared Society of Computer Sciences - SUSL's post.",
        "id": "1078877558819703_1767294393311346",
        "views": "123",
        "reach": "435",
      },
      {
        "story": "Cyborgs shared Gamers On Board's video.",
        "id": "1078877558819703_1766615263379259",
        "views": "23",
        "reach": "45",
      },
      {
        "story": "Cyborgs was feeling motivated.",
        "id": "1078877558819703_1547214361986018"
        "views": "243",
        "reach": "34",
      },
    ],

  }
}

因此,正如您所看到的帖子列表一样,浏览量和覆盖率值也与每个对象相关.

So, as you can see along with post list, views and reach values are also coming relevant to each object.

那么,这可能吗?怎么样?

So, is this possible ? How ?

推荐答案

是.可以做到这一点.

在这里,我附加了我的图形API URL,通过它您可以获取所选页面的所有帖子以及见解.

Here, I'm attaching my graph API URL through which you can get all the posts of the selected page along with the insights.

您可以在FB图形API工具或任何其他SDK中指定以下请求.

You can specify below request in FB graph API tool or any another SDK.

/{page-id}/posts?fields=insights.metric(post_impressions_fan,post_engaged_users)

您最多可以指定逗号分隔的数据分析指标.

You can specify as much as insights metrics with the comma separated.

您可以在下面的URL中找到更多的洞察指标. https://developers.facebook.com/docs/graph-api /reference/v3.0/insights

You can find more insights metrics at below URL. https://developers.facebook.com/docs/graph-api/reference/v3.0/insights

这篇关于通过单个API调用获取具有见解的帖子-Facebook Graph API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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