如何使用Graph API将图片链接发布到Facebook?

Abe*_*ler 7 facebook facebook-graph-api

我尝试了两种不同的方法.

首先是指定的链接/PROFILE_ID/feed链接参数(如"出版"中所述这里).问题是,如果我指定除应用程序URL以外的任何内容,我会收到一条错误消息,指出该URL无效.

第二种是使用该/PROFILE_ID/links方法并指定图片URL.问题是,当它发布时,它只显示消息和URL.我已经指定了图片,名称和消息的值,但没有显示.

如何发布带有姓名,信息和图片的链接?

Nic*_*set 5

你的第一种方法是正确的.你的网址是以http://开头的吗?您使用的SDK是什么?

如本页所述,该示例表明它应该可行. http://developers.facebook.com/docs/reference/api/post

curl -F 'access_token=...' \
 -F 'message=Check out this funny article' \
 -F 'link=http://www.example.com/article.html' \
 -F 'picture=http://www.example.com/article-thumbnail.jpg' \
 -F 'name=Article Title' \
 -F 'caption=Caption for the link' \
 -F 'description=Longer description of the link' \
 -F 'actions={"name": "View on Zombo", "link": "http://www.zombo.com"}' \
 -F 'privacy={"value": "ALL_FRIENDS"}' \
 -F 'targeting= {"countries":"US","regions":"6,53","locales":"6"}' \
 https://graph.facebook.com/me/feed
Run Code Online (Sandbox Code Playgroud)


Abe*_*ler 1

我最终通过使用该/PROFILE_ID/feed方法解决了这个问题,然后Stream post URL security在我的应用程序安全设置中禁用。希望这对某人有帮助!

  • 在哪里禁用该设置? (2认同)