How to post a link with a picture to Facebook using the Graph API?
I have tried two different methods.
The first is to specify the link in the /PROFILE_ID/feed
link argument (as described under "publishing" here). The problem is that if I specify anything other than my application URL i get an error 开发者_StackOverflowsaying the URL is invalid.
The second is to use the /PROFILE_ID/links
method and specifying a picture URL. The problem is that when it posts it only shows the message and the URL. I've specified values for picture, name and message but none of them show.
How can I Post a link, with a name, message and picture?
Your first approach is the correct one. Is your url starting with http://? What SDK are you using?
As described on this page, the example suggest it should work. 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
I ended up solving this problem by using the /PROFILE_ID/feed
method and then disabling Stream post URL security
in my application security settings. Hope this helps someone!
精彩评论