小编Tom*_*m C的帖子

使用 Facebook Graph API 为 Instagram 进行分页

我正在尝试使用 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}}
Run Code Online (Sandbox Code Playgroud)

这成功地返回了 Instagram 商业帐户中的 25 个最新帖子以及 json 的分页 > 光标部分中的“之后”字段。

但是,我现在正在尝试使用某种形式的分页来获取接下来的 25 个帖子。

我读过 Facebook Graph API 支持游标和基于时间的分页,但下面的文章表明 Business Discovery 的 /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}}
Run Code Online (Sandbox Code Playgroud)

因此,非常感谢有关如何格式化这些查询字符串以便为 Instagram 媒体对象执行分页(使用 after/before 参数、时间戳或 post_ids)的任何帮助。

谢谢。

facebook-graph-api instagram

3
推荐指数
1
解决办法
2893
查看次数

标签 统计

facebook-graph-api ×1

instagram ×1