Return only albums with at least one photo

Asked

Viewed 115 times

5

I am currently making the following FQL query to return all the logged-in user’s Albums that have at least one photo (with the amount of photos):

SELECT object_id, name, photo_count 
FROM album 
WHERE owner = me() AND photo_count > 0

Unfortunately version 2.1 of the platform removed FQL support.

I know I can get the figures in question with the following call:

me/albums?fields=name,id,count

But I couldn’t find a way to filter out empty albums. Iterate each value and check those with count other than zero is not very convenient as a user may have a large amount of Albums; I would be required to iterate over multiple pages just to count the amount of non-empty albums.


Cross posting to Soen: Question in English

  • 1

    Anthony, from what I saw there is really no way to do this, the Graph API is quite restricted regarding the customization of the results... But I saw that version 2.0 will be supported until August 2016 (https://developers.facebook.com/docs/apps/changelog). Do you really need to make this migration? Could not continue in version 2.0 and using FQL for this purpose only, the other requests being made for version 2.1?

  • Hi Wakim, yes, it’s an excellent suggestion. I’m contemplating the possibility of staying in version 2.0; 2.1 broke a lot for me. [Dull mode on] It seems that each upgrade on the Facebook platform introduces half a dozen worsenings; not to mention the unavailability and updates silent round and a half break some aspect of my application [Dull mode off]. Will they introduce filters like this in a later version of the API or will we run out of functionality? :(

  • 1

    I have no idea, I researched something but I didn’t find it. I never used the FQL directly, but I only used a little bit of the Graph API to retrieve and treat a user’s Timeline elements. I think they should provide some "polyfill" for this migration, the FQL is very powerful, I can imagine how difficult it will be to migrate complex queries when they take off the air... It might be worth starting a discussion in the group (if there isn’t, I haven’t been able to join the group yet) https://m.facebook.com/groups/fbdevelopers/

  • @Wakim, apparently there is no solution at all. If you want to turn your comment into an answer I can accept it. Hugs.

1 answer

1


Unfortunately there is no possible manipulation for this purpose of filtering or sorting results, the Graph API is very rigid in this regard.

Like version 2.0, which still supports FQL, will be supported until 07/08/2016, my suggestion is to continue using the FQL to make this and other queries more complex and migrate the simplest accesses to version 2.1.

As the FQL is infinitely more powerful, in terms of complexity and the possibility of data analysis, than the Graph API only. We hope that the Facebook provide by 2016 an alternative that meets most needs, otherwise it could cause problems for many people.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.