【问题标题】:Instagram Graph API: Convert ig_id to id - Migrating from Instagram API => Graph APIInstagram Graph API:将 ig_id 转换为 id - 从 Instagram API 迁移 => Graph API
【发布时间】:2019-09-20 12:31:03
【问题描述】:

我正在尝试将自定义报告平台从 Instagram 的旧 API 迁移到新的 Graph API (https://developers.facebook.com/docs/instagram-api/reference/media/#metadata)

我有一个数据库,它存储了几年的帖子数据用于报告目的,它以 xxxxxxxxxxxxxxxxxx_yyyyyyyy 的旧格式保存帖子的 ID。

新的 Graph API 返回两个 ID idig_idig_id 与上面原始 ID 的 x 部分相关。新的 Graph API 不允许您通过 ig_id 查询媒体,只有 id,所以我的问题是 - 有没有办法将 ig_id 转换为 id 或从ig_id?

【问题讨论】:

    标签: instagram-api instagram-graph-api


    【解决方案1】:

    不幸的是,我不相信有直接的方法可以从旧 id 转到新 id。我这样做的方式是获取完整的媒体列表,然后遍历该列表以匹配旧 id。我想你已经知道了,但我会写出来以防其他人发现这篇文章并想要更多详细信息。

    如果您转到here,第 6 步,您将看到用于检索指定企业帐户的所有媒体对象的端点。网址是:

    https://graph.facebook.com/v4.0/business-id-here/media?access_token=access-token-here

    这将返回新图形 api 的 id 列表。

    此时,您需要提取每个媒体对象的详细信息。文档是here。终点是:

    https://graph.facebook.com/v4.0/media-id-here?access_token=access-token-here&fields=caption,children,comments,id,ig_id,media_type,media_url,owner,permalink,shortcode,thumbnail_url,timestamp,username

    这将为您提供旧 id 和新 id,可以匹配。

    【讨论】:

    • Facebook 已将与 Instagram api 相关的所有内容都变成了真正的 $#%@!!!
    • 不能再同意了
    猜你喜欢
    • 2018-10-31
    • 1970-01-01
    • 1970-01-01
    • 2018-12-06
    • 2019-12-20
    • 2018-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多