Can we post photos on friends wall using Graph API

五迷三道 提交于 2019-12-24 17:53:16

问题


Is it possible to upload photos on friends wall? The documentation never mentioned that! but its happening. I am able to post to the /friend_id/photos connection.

I am actually running my app on local server using localhost tunneling. So, in August, I made an app where people can post photos on their friends wall (upon their request only). So, As I was pretty new to FB API, I didn't notice that it is not allowed.

I just left the app for few weeks and came back to fix things and I noticed that I am unable to post photos to the /friend_id/photos connection (Its just not working. I am not getting any errors). Its not even working for other possible connections like /friend_id/feed Is my app restricted to some graph actions?

So, I just created a test app and executed the same connection /friend_id/photos and **its working. Don't know why!**

This is not the end of surprise:

  1. I successfully posted a photo on my friends wall using my test app
  2. When I opened the photo, I could see its from "Surya's Photos" - my photos
  3. I don't see that photo in my albums. I just don't know where its actually saved.


回答1:


Update 2: This is indeed possible (is it a bug?) the same regular way.

But seems that posting of photo to other user's /photos connection behave very differently from posting to /me/photos. Here are some of the facts about posting to /FRIEND_ID/photos:

  1. Every photo published that way creates separated album named Posting User's photos (that's it uploaded photos will never be grouped and there is no way to see all of them in single place).
  2. That photo will not be visible in albums of either user or friend, but only will be seen/accessible via feed/timeline.
  3. And for sure this is only working if you able to post on that friend's feed

So it really behaves just like any other content posted to friend's feed.

I would say if you not rely on album functionality and persistance of those photos and only want to "share" photo on friend's wall, go for it (unless it's proven to be bug).


TL;DR; No you cannot post photo to friend's /photos connection. Well, you can post photo to friend's /photos connection but it will not behave the same way if posted to your's /photos.

According to documentation of photos connection for user:

Create
You can post photos to a user's Wall on their behalf by issuing an HTTP POST request to PROFILE_ID/photos with the publish_stream permissions and the following parameters.

Also according to documentation of photo object:

https://graph.facebook.com/USER_ID/photos - The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.

So generally speaking you trying to upload photo to other user's album but you may only post photos to your profile (or to page if using access_token for page).

You may however post to feed of other user (for example post may or may not have picture as attachement, which isn't the same as photo).

Update: Photos may only be uploaded to /USER_ID/photos than USER_ID is the same as me (owner of access_token).




回答2:


Is my app restricted to some graph actions?

There’s some places where FB say in the docs or developer blog posts, “If you misuse feature xy, your app’s ability to use it may be revoked” (not literally; I’m paraphrasing here, but something like that).

So it’s absolutely possible, that FB revoked the ability to post photos to friend’s walls specially for your app, because too many users receiving photos on their walls this way have marked them as “spam”.

(“Revoking a permission” is maybe not the exactly correct wording here; I think it’s more likely the Graph API accepts the requests made from your app in the first place, but then silently filters it out in the back; that would also explain why you not get any errors.)



来源:https://stackoverflow.com/questions/12237172/can-we-post-photos-on-friends-wall-using-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!