8

我正在寻找一种在 Instagram Graph API ( https://developers.facebook.com/docs/instagram-api/reference/media/insights ) 中使用基于 userId 的嵌套查询来获取 Media Insights 指标的方法,即使在客户从个人帐户切换到企业帐户。

我使用这个嵌套查询来获取我需要的所有数据:(https://graph.facebook.com/v3.2/{userId}?fields=followers_count,media{media_type,caption,timestamp,like_count,insights.metric(reach, impressions)}这部分会导致错误:insights.metric(reach,impresss) ——但它适用于一个一直是商业账户的账户)

但是,由于一些链接到 userId 的媒体是在用户切换到企业帐户之前发布的,而不是仅返回之后发布的媒体的数据,API 会返回此错误:

{
    "error": {
        "message": "Invalid parameter",
        "type": "OAuthException",
        "code": 100,
        "error_data": {
            "blame_field_specs": [
                [
                    ""
                ]
            ]
        },
        "error_subcode": 2108006,
        "is_transient": false,
        "error_user_title": "Media Posted Before Business Account Conversion",
        "error_user_msg": "The media was posted before the most recent time that the user's account was converted to a business account from a personal account.",
        "fbtrace_id": "Gs85pUz14JC"
    }
}

有没有办法通过 API 知道在帐户从个人帐户切换到企业帐户之前和之后创建了哪些媒体?或者有没有办法获取帐户切换的日期?

我目前看到的获取所需数据的唯一方法是使用/media边缘并查询每种媒体的见解,直到出现错误。然后我会得到大约我需要的日期。但是,这根本没有优化,因为我们的速率限制为每位用户每小时 200 次呼叫。

4

3 回答 3

3

我也有同样的问题。

现在,我在查询之间切换(如果首先有错误)

"userId"?fields=id,media.limit(100){insights.metric(reach, impressions)}

"userId"?fields=id,media.limit(100)

我向用户展示了零的所有见解。

我不知道它们是否是最佳选择,例如确定转换为业务的时间并在此 DateTime 范围内获取帖子

于 2019-06-07T18:16:21.660 回答
2

我遇到了同样的问题并像这样解决了它:

  • 像您一样使用嵌套查询,包括insights.metric
  • 如果出现错误,请在没有insights.metric- 的情况下再次调用以至少获取所有其他数据

对于大多数帐户,它可以工作,并且没有额外的 API 调用。其余的,我只是无法获得洞察力,我必须忍受它,我猜——直到 Facebook/IG 解决这个问题。

于 2019-04-10T07:38:24.093 回答
0

我遇到了同样的问题并像这样解决了它:

第 1 步:将您的 Instagram 帐户转换为专业帐户。

Step2:然后根据 Error Post 在 Instagram 上发布新帖子并获取他们的 Post-ID。

Step3:然后尝试使用该 Post-ID 获取请求。

{Post-ID}?fields=comments_count,like_count,timestamp,insights.metric(reach,impressions)

curl -i -X GET "https://graph.facebook.com/v12.0/{Post-ID}?fields=comments_count%2Clike_count%2Ctimestamp%2Cinsights.metric(reach%2Cimpressions)&access_token={access_token}"

更多信息:见解

于 2022-02-06T20:45:43.273 回答