Instagram Graph API:将ig_id转换为id-从Instagram API迁移=> Graph API

问题描述 投票:2回答:1

我正在尝试将自定义报告平台从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或从中检索id ig_id

instagram-api instagram-graph-api
1个回答
0
投票

[不幸的是,我不认为有直接方法可以将旧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。

© www.soinside.com 2019 - 2024. All rights reserved.