I'm finishing a flash application. You can see the app here:
https://apps.facebook.com/wacky-winter-woolies/
The app sends an FQL query to get the user's albums, generates thumbnails based on cover_object_id. This part works fine. After clicking on an album the app loads photo thumbnails in the same fashion. We've just discovered that although it usually works, for some people and some photos instead of a thumbnail facebook returns the following error:
{"error": {"message": "Unsupported get request.","type": "GraphMethodException"}} picture
The photo thumbnail request URL:
https://graph.facebook.com/(object_id)/picture?type=thumbnail&access_token=(valid_token)
The query used to generate the list of photos in an album:
var fql:String = "SELECT object_id, aid FROM photo WHERE aid = \""+aid+"\"";
The permissions for the app:
'permissions' => 'publish_stream,user_photos,friends_photos'
Essentially some photos return an error. The object_id of the photo is valid as it's pulled right from the FQL result - here is an example of an actual request that returns the error, complete with token
https:// graph.facebook.com/10150102643214148/picture?type=thumbnail&access_token=AAACJlS1owXcBAAh9KIBAYDobeWAvcuHdr96DHYpJJafhHjianz07jWZBYj6klqqZC4cYA2ZCOxTt2fOXCNAH4GBZCPK75nlLdZCZA8xfW2xgZDZD
(note: space is added because as a new user I can't post more than 2 links)
What is causing this? How can this be fixed?
Edit1 :
This is interesting.
Here are the raw object_id's of a set of pictures. One of them is invalid. Guess which?
- 387476299148
- 387476299148
- 10150102643214148
- 492300644148
- 492300644148
For some reason for certain pictures in the album FQL returns an unusually long object_id. Those long object_id's are invalid.
As you can see both the valid and invalid IDs end with a similar sequence - 148. Even though I'm handling the result as a string and not removing any characters from the result it's possible facebook wanted to send me 10150_102643214148 instead and slipped.
Currently I'm just throwing out the invalid IDs. I hope this is enough to prevent blank photos and facebook doesn't poison my query results with any more bogus data.
Edit2: The above approach didn't work, for some reason. Some pictures would still result in an error. Fortunately the FQL tables had properties like "src_small" and "src_large" which return the direct link to the photos. Even though graph supposedly allows to retrieve any image using it's API I had to fall back to the src results from the query - I guess that was a patch of sorts for situations like this.
In short Facebook's GRAPH API is broken. I hope it gets fixed soon.