开发者

how to change privacy settings for photos posted on facebook via graph API

When publishing a post on the user's wall (via the graph API) I know how to change the privacy settings using the "privacy" field, and it works fine.

However, how do I do the same on a photo published into an album? Photos in albums also have privacy settings (you can set them manually so I guess you can set t开发者_运维技巧hem via the API, or can't you?). The privacy field for the Photo object does not exist. I thought it may be undocumented so I tried it, but it doesn't work.

So how do I change the privacy settings for a photo? (ideally at the very moment of publishing it)

thanks m.


From what I've seen you can't set a Photo's privacy directly when publishing (the API seems to only take "source" and "message" values).

However, if you create a new Album and pass in "visible" with a value of "everyone" then the album is "public".

    <form action="https://graph.facebook.com/me/albums?access_token=<?= $fb_access_token ?>" method="POST">
        Album name
        <input name="name" type="text" value="Name of Album"><br/><br/>
        Album message
        <input name="message" type="text" value="Message on Album"><br/><br/>
        Album visible level
        <input name="visible" value="everyone" /><br/><br/>
        <input type="submit" value="Create"/>
    </form>

If you then upload a Photo into that album then the Photo will also be "public".

    <form enctype="multipart/form-data" action="https://graph.facebook.com/[ALBUM_ID]/photos?access_token=<?= $fb_access_token ?>" method="POST">
        Please choose a photo
        <input name="source" type="file"><br/><br/>
        Say something about this photo:
        <input name="message" type="text" value=""><br/><br/>
        <input type="submit" value="Upload"/>
    </form>

To my knowledge the "visible" setting is undocumented... I found it in the FQL table: http://developers.facebook.com/docs/reference/fql/album/

You would think it accepted "privacy" but in my experience it does not. http://developers.facebook.com/docs/reference/api/album/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜