Facebook graph api. Get photos from albums
Actually there is a better way to achieve this, nesting the request
Passing albums as a parameter, and then filter the fields from the connection photos that you want to, for example here I got just everything I need from albums and photos, also this results can be limited
me?fields=albums.fields(id,name,cover_photo,photos.fields(name,picture,source))
You may only use fields
with properties that exists for objects.
By issuing GET request to next URL you'll get list of albums ids only:
https://graph.facebook.com/me/albums?fields=id&access_token=...
Same can be achieved by running next FQL
query on album
table:
SELECT aid FROM album WHERE owner=me()
Actually albums
connection of user
doesn't really contain list of photo
objects but album
(which have photos
connection). So to get photos owned by user you'll need iterate over all of his object and getting photos for every album. Again you may use fields
argument to limit resulting data. This can be done faster if using batch requests.
Or With FQL
it may be done like this (two tables photo
and album
involved):
SELECT pid FROM photo WHERE aid IN (SELECT aid FROM album WHERE owner=me())