Search code examples
facebookfacebook-graph-apipreloaderfacebook-oauth

Can't Load Many Pictures from Graph API at Once


I am trying to preload images for a visual Facebook app, but when I try to preload them half don't get loaded with this error:

{ "error": { "message": "(#4) Application request limit reached", "type": "OAuthException", "code": 4 } }

There doesn't seem to be any documentation about this.... anyone have any ideas?


Solution

  • Based on your comment above, you're making a separate request for each individual image which is why you're hitting a rate limit, you should request them in bulk, easiest way is to do something like (the exact syntax is language/SDK specific) https://graph.facebook.com?fields=picture&type=large&ids=COMMA_SEPERATED_LIST_OF_USER_IDs&access_token=YOUR_ACCESS_TOKEN

    The response format from this is:

    {
      "4": {
        "picture": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/49942_4_1525300_n.jpg"
      }, 
      // Other users you included in the IDs parameter
    }
    

    (but all the SDKs will wrap that and make it easier to iterate over)