Is there any ways to retrieve facebook photos uploaded by myself only? I don't need to retrieve photos that are uploaded by others.
photos = facebookClient.fetchConnection("me/photos", Photo.class);
List<com.restfb.types.Photo> photosList = photos.getData();
I am doing it for my jsp page and using RestFB library.
Use FQL to get only your photos:
String query =
"SELECT pid, src, src_small, src_big, caption FROM photo WHERE owner=" + yourUid;
List<JsonObject> queryResults =
facebookClient.executeFqlQuery(query, JsonObject.class);
for(int i=0; i<queryResults.size(); i++)
{
String photoUrl = queryResults.get(i).getString("src");
// add your code to use photoUrl
}
And the you can iterate through queryResults to get src for each image.
You can use me/photos/uploaded
, which does exactly what you want. https://developers.facebook.com/docs/graph-api/reference/v2.1/user/photos/
photos = facebookClient.fetchConnection("me/photos/uploaded", Photo.class);
List<com.restfb.types.Photo> photosList = photos.getData();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.