开发者

Graph API equivalent for sharing photo?

开发者 https://www.devze.com 2023-03-27 03:13 出处:网络
Trying to create a wall post with photo attached. Phot开发者_运维问答o is a Facebook-hosted photo within some album.

Trying to create a wall post with photo attached. Phot开发者_运维问答o is a Facebook-hosted photo within some album.

Problem here - Facebook won't allow including facebook-hosted content in posts ((#100) FBCDN image is not allowed in stream )

From the Web UI, it's possible to "Share" a photo on my wall - that's almost what i need but i don't know the Graph API equivalent for that operation (if there's any)

Any help appreciated.


The answer is "me/links"

passing http://www.facebook.com/photo.php?fbid=** as a link


With the Graph API you can share the photo as a link.

this is the documentation: https://developers.facebook.com/docs/reference/api/user/#links

You need send a POST request to me/feed/. And indeed send the link: http://www.facebook.com/photo.php?fbid=[the id of the photo]

Make sure the publish_stream permission is allowed for the access_token.

with Jquery this is an example:

$.post( 
   'http://www.facebook.com/me/feed', 
   { 
     link: 'http://www.facebook.com/photo.php?fbid=[THE_PHOTO_ID], 
     access_token: [YOUR_ACCESS_TOKEN]
   }, 
   function(result) { console.log('shared'); },
   'text'
);
0

精彩评论

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