3

I'm following these steps to create a wall post with a picture using the FB Graph API:

  1. Upload the picture into a specified folder (working OK) -> this returns an id and a post_id
  2. Send a POST to https://graph.facebook.com/me/feed with the following parameters:

access_token - my current access_token

message - a simple message like "hello"

object_id -the post_id obtained in step 1, after photo upload

The post message appears on the wall, but there is no photo:

http://img545.imageshack.us/img545/1369/screenshot6ev.png

What am I doing wrong?

I mention that i don't want to attach a link to the photo. I want the image to appear without any hiperlink, like the ones that are manually uploaded when creating a new post.

4

4 回答 4

3

它应该object_attachment代替object_id.

在此处查看文档:https ://developers.facebook.com/docs/graph-api/reference/user/feed/

于 2013-12-20T15:48:45.607 回答
1

我一直在为同样的事情苦苦挣扎 - API 似乎完全遗漏了大多数人所做的事情。

我发现的唯一解决方法是首先创建一个唯一的序列号相册,然后将照片发布到该相册:

FB.api('ALBUM_ID/photos', 'post', params, function(response) { ... });

其中 params 包含帖子消息和照片/图片的 url。但是,为一张照片创建一个相册,真是太麻烦了!但是,这样您就不会得到随后发布的图片组合在一起。

How to do simple Facebook status post with text and picture中有更完整的代码片段。

于 2013-10-10T05:37:40.410 回答
0

您应该使用不带no_story参数的/me/photos 。您可以将消息添加到消息参数中,它将出现在用户的故事板上。

于 2014-05-05T11:12:24.080 回答
0

照片上传后使用您的 photo_id 获取照片信息。照片信息包括一组指向其缩略图的链接。用户通过“/me/feed”图形 API 在墙上发布的缩略图链接之一。请参阅链接以获取更多详细信息:https ://stackoverflow.com/a/23199781/989896

于 2014-04-21T14:55:54.240 回答