Facebook graph API response size limiting (error code 1)
Asked Answered
M

2

7

Just sharing some information I came across while testing my application.

Facebook Graph API implements rate limiting as described on their documentation page. Today I was trying to retrieve the feed from CNN facebook page and I got the following 500 error:

{"error":{"code":1,"message":"Please reduce the amount of data you're asking for, then retry your request"}}

This is the query I was trying to test:

https://graph.facebook.com/v2.3/5550296508/feed?fields=id,actions,application,caption,created_time,description,from,icon,is_hidden,link,message,message_tags,name,object_id,picture,place,privacy,properties,source,status_type,story,story_tags,to,type,updated_time,with_tags,shares,likes.limit(50),comments.filter(stream).limit(50){attachment,created_time,from,id,like_count,message,message_tags,comments{attachment,created_time,from,id,like_count,message,message_tags}}&access_token=xxxxxxx

Monda answered 19/4, 2016 at 22:53 Comment(2)
I've even seen this error from Facebook's own editor. Power editor seems to have the problem less, but I suspect it is just an API limit issue that isn't properly reported. I received the error after updating several custom audiences via the API and then trying to edit the targeting within business.facebook.com.Varia
Still getting it :-(Varia
M
14

I tried to set different limit values to reduce the size, and eventually it worked. By inspecting the response size and playing around with it a bit, I found that the error is thrown when the response reaches (roughly) the 200k threshold.

I tested with Graph API versions 2.3 - 2.4 - 2.5 - 2.6

I found no documentation about this response size limit on the facebook APIs documentation, so it's possible that it will be changed in the future.

Just thought it might be useful to share if you are modelling something using their API.

Monda answered 19/4, 2016 at 22:53 Comment(3)
what is the safe limit that you are using?Seignior
@Seignior I set it at 200kBMonda
I even tried setting a limit of 1. Still getting the same error. Any help, please?Fierce
S
4

I originally misready the error message Please reduce the amount of data you're asking for, then retry your request and assumed I was getting rate-limited -- i.e. making too many API calls in a short time period. Thanks Dieghito for your answer, which helped me realize the error is about the response size.

In my case it was fetching /comments that was exceeding the response size limit. I had the limit set to 1000, which was fine for most posts. But for posts with a lot of lengthy comments, the response size grew too large. I had paging already setup, so simply requesting fewer comments per page (limit: 50 or 100) solved the problem for me. Just posting that here for people whose problem could be related to comments.

Shoe answered 3/2, 2017 at 16:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.