I'm doing a FB app where users are able to upload a photo to a photo album that is created at the same time. My problem is that I only want the photos to go into the album avoiding the 开发者_StackOverflow中文版post of the same photos on the users wall and in the users news feed. Not sure if that's possible or if there's a workaround.
Thanks for your help
You just need to use the parameter no_story=1
within your call.
This is not documented on Album or Photo, but is on User and it works for Photos as well.
Related to: facebook upload photo without news feed post? Possible?
The only way to work around this is to delete the stories (posts) generated for each photo upload. To answer another question in the thread you can do batch photo uploads, see this blog post https://developers.facebook.com/blog/post/493 that explains how to do this using Batch Requests.
Assuming you used batch requests (or even if you upload one at a time) you can follow this process:
After uploading the photos through Graph API, note the id of the photo(s) uploaded.
Make a call to https://graph.facebook.com/me/feed?fields=object_id&access_token=youruseraccesstoken to get your latest wall post information. You may choose to pass on a limit parameter so you do not get too many results.
Loop through the results, looking to match the object_id to the information saved in step (1). Note the corresponding id, these are the wall post id(s).
For each wall post id found in step (3) issue an HTTP DELETE to https://graph.facebook.com/POST_ID with an access_token that has publish_stream access.
The wall posts should be gone but the photos still in the album.
精彩评论