Reputation: 3009
I'm trying to parse the posts of a facebook page using graph API and here's the sample json output:
{
"posts": {
"data": [
{
"message": "post1",
"object_id": "786625684729323",
"type": "photo",
"updated_time": "2014-10-19T16:59:07+0000",
"id": "381290831929479_786636778061547",
"created_time": "2014-10-19T16:59:07+0000"
},
{
"message": "post2",
"object_id": "778854645506427",
"type": "photo",
"updated_time": "2014-10-19T16:09:04+0000",
"id": "381290831929479_786616228063602",
"created_time": "2014-10-19T16:09:04+0000"
}
]
}
}
Multi-photo upload is when you upload more than one picture and it will appear on the news feed that you've added X photos in an album.
The first post is a multi-photo upload but if I will get the picture using the object_id, it will only return the first picture uploaded. The second post is a single photo upload which works fine. How do you determine if a photo post contains more than one picture? and if it is a multi-photo post, how do you get the object_id of the other pictures?
Upvotes: 1
Views: 273
Reputation: 8378
Recently I came across this situation in my app and this is how I handle. You get only first picture URL in your feed in picture or full_picture parameter in your feed section.
If you add photo in your post, you will get an object_id value for that, so don't confuse with that.
Add link parameter in your feed section, which gives you the number of photos that the user has uploaded in their post using the count. Refer below link.
Now you got the number of photos you have posted in that particular post. Also get the created_time API as of now. Like this,
me?fields=id,name,feed{created_time,link}
Save the created_time parameter value and now go to photos section in albums. And pass the parameters as,
me?fields=id,name,albums{photos,created_time}
Match the created_time value in the photos section and get the photo's related to that post. As of now, am working on this way and its working fine. Sometimes I get one minute delay in post photos created_time. You also need to handle this. Hope it helps you as of now and I get you once I get proper parameter to handle this situation.
Upvotes: 3