Facebook GraphAPI通过限制减少数据量 [英] Facebook GraphAPI Reduce amount of data with limit

查看:94
本文介绍了Facebook GraphAPI通过限制减少数据量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在努力查找记录在哪里(如果有的话),但是当从FB GraphAPI请求数据时,我得到了以下错误消息.

So I'm struggling to find where this is documented (if at all), but I'm getting the following error message when requesting data from the FB GraphAPI.

"Please reduce the amount of data you're asking for, then retry your request"

我打的电话是:

/v2.3/user1/posts?fields=object_id&limit=100

如果我将其更改为:

/v2.3/user2/posts?fields=object_id&limit=100

它返回100个项目.

为什么它只对一个用户有效,而对另一个用户无效?

Why would it work for one user, and not the other?

两个请求都通过访问令牌(不属于任何用户)进行身份验证,无论是从我的代码运行还是从developer.facebook.com的Facebook Graph API控制台运行它,我都遇到相同的错误

Both requests are authenticated via an access token (not belonging to either user) and I get the same error whether running it from my code, or the Facebook Graph API console of developers.facebook.com

推荐答案

来自

The response from CBroe is correct. Facebook returns this error if it finds that too many internal resources are needed to respond to your request.

因此,您必须按照响应内容进行操作:限制它.

Therefore you have to do what the response says: limit it.

这可以通过(afaik)2种方式完成:

This can be done in (afaik) 2 ways:

  1. 使用limit参数并减少您期望从API获得的响应数量
  2. 提供一个时间范围(使用since和/或until)以仅提取特定时间范围内的数据(帖子/视频).
  1. Use the limit parameter and reduce the amount of responses you expect from the API
  2. Provide a timeframe (using since and / or until) to fetch only data (posts / videos) for a specific timeframe.

我们遇到了与您相同的问题,但是从页面中检索了视频.不幸的是,即使我将其设置为limit=1,使用limit参数也无法正常运行 .但是通过使用since/until参数,我们最终得到了结果.

We had the same issue as you, but with retrieving videos from a page. Unfortunately using the limit parameter did not work, even when I set it to limit=1. But by using the since / until parameters we finally got results.

因此,我建议实施一个时间表以减少数据量,或者拆分您发出的请求量.例如如果您希望获得过去3个月的所有帖子并遇到上述错误:请使用sinceuntil将您的请求一分为二.如果仍然无法解决:请继续分割...

Therefore I suggest to implement a timeframe in order to reduce the amount of data, or alternatively, split the amount of requests you make. e.g. if you want all posts from the past 3 months and run into the mentioned error: split your requests in half using since and until. If that still does not work: keep splitting...

=> 划分并征服;)

希望有帮助, KR,ebbmo

Hope it helps, KR, ebbmo

这篇关于Facebook GraphAPI通过限制减少数据量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆