I'm writing an application that uploads a photo to facebook. I'm not supplying an album ID so an album is created on behalf of my app.
My question is: how do I get the album ID the photo was uploaded to?
When I GET
the the photo information the album isn't present in the JSON which was my hope.
Jimmy Sawczuk's answer is close, but doesn't work because FQL Photo table columns aid
and pid
are Rest/FQL API ids, not Graph API ids.
Fortunately the object_id
and album_object_id
columns in this table are indexable (contrary to the documentation) so this should give you both Rest/FQL & Graph ids for the album:
select aid, album_object_id from photo where object_id = ${GRAPH_PHOTO_ID}
In general object_id
fields in Rest/FQL API responses are Graph API id (except for photo notifications, where it's the Rest/FQL id).
Re HonkyHonk's answer: not all photo link
urls have a set
parameter; in this case I think you can find the Rest/FQL API photo id from its other parameters, and then use Rest/FQL API to get the album id:
(id << 32) | pid
2360873244068853905
id
, _
and pid
100002937903251_155052
It would help a lot if Facebook could document something about the two types of ids. Also the Graph API Photo schema should include the album's Graph API id.
This is the easy way to get it :
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With