【发布时间】:2018-12-06 12:48:18
【问题描述】:
我正在尝试使用 Facebook Graph API 为 Instagram 企业帖子发出 API 请求。
https://developers.facebook.com/docs/instagram-api/business-discovery
使用我正在调用的 Facebook 的 Graph API Explorer
<my_facebook_page_id>?fields=business_discovery.username(<instagram_business_account_username>){media{comments_count,like_count, caption, media_url, media_type,timestamp}}
这会成功返回 Instagram 业务帐户中的 25 个最新帖子以及 json 的分页 > 光标部分中的“之后”字段。
但是,我现在正尝试使用某种形式的分页来获取接下来的 25 个帖子。
我读到 Facebook Graph API 支持光标和基于时间的分页,但以下文章建议业务发现的 /media 端点仅支持基于光标的分页。
https://developers.facebook.com/docs/instagram-api/reference/user/business_discovery#pagination
我尝试了上述查询的几种变体,试图获取接下来的 25 个帖子,但它们都返回最近的 25 个帖子(与上面的初始查询相同)。
以下是我尝试过的一些查询示例。
<my_facebook_page_id>?fields=business_discovery.username(<instagram_business_account_username>){media{comments_count,like_count, caption, media_url, media_type,timestamp}}&after=<after_code_from_first_call>
<my_facebook_page_id>?fields=business_discovery.username(<instagram_business_account_username>).after(<after_code_from_first_call>){media{comments_count,like_count, caption, media_url, media_type,timestamp}}
因此,对于如何格式化这些查询字符串以便对 instagram 媒体对象执行分页(使用 after/before 参数、时间戳或 post_ids)的任何帮助,我们将不胜感激。
谢谢。
【问题讨论】:
-
我也想知道如何使用分页光标来获取下一个“X”个媒体记录。这有什么好运气吗?
标签: facebook-graph-api instagram