I combed through the Facebook documentation but didn't see an obvious way to return ONLY photos on a user's newsfeed. Specifically:
Give a FB access token, I want to get the newsfeed filtered to only photos that were posted.
https://graph.facebook.com/me/home?access_token=
Returns the entire newsfeed. I see that elements have a "Type" attribute, that has a value of "photo" when it's a photo.
How can I scope the response to only return photos?
Sure, you can do this using FQL:
SELECT
post_id, message, attachment
FROM
stream
WHERE
filter_key
IN (
SELECT
filter_key
FROM
stream_filter
WHERE
uid = me()
AND
name = "Photos"
)
Working demo using Graph API Explorer:
https://developers.facebook.com/tools/explorer?method=GET&path=fql%3Fq%3DSELECT%20post_id%2C%20message%2C%20attachment%20FROM%20stream%20WHERE%20filter_key%20IN%20(SELECT%20filter_key%20FROM%20stream_filter%20WHERE%20uid%3Dme()%20AND%20name%3D%22Photos%22)
EDIT:
Looks like that link won't work. This is the request to the graph api. You need read_stream
permissions.
https://graph.facebook.com/fql?q=SELECT post_id, message, attachment FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid=me() AND name="Photos")
Facebook has added a filter parameter to the /me/home endpoint
so if you query /me/home?filter=photos
you get only photos from the users News Feed