Use Graph API Explorer to post a photo

一曲冷凌霜 提交于 2019-12-22 11:11:55

问题


My ultimate goal is to do this programmatically, but as a sanity check I'm trying to just post an uploaded photo (from my computer) to a Facebook page using the Facebook Graph API Explorer. I have the access token and photo_upload and publish_stream permissions.

I just don't understand what to do to indicate where the photo is. How can I do it?
Thanks.


回答1:


I don't think the Graph API explorer tool supports file upload, so you won't be able to use it to check your uploads.

Facebook accepts a url param for image uploads - point that to a full image url, and Facebook should pick it up. Since it's just a string, you can use the Explorer for that.

However, Facebook should come back with reasonable errors for photo uploads - I'd start coding rather than worry about the explorer tool!




回答2:


Use curl with the -F and "source=" flags and it should work. Here is a code snippet from one of our applications (we construct this curl command from PHP):

curl -F 'access_token=xxxxxx' -F 'source=@/path/to/image.jpg' 
-F 'message=' -F 'privacy={"value": "EVERYONE"}' 
https://graph.facebook.com/FB-ALBUM-ID/photos



回答3:


I managed to post images from Graph API explorer using this!

Hope this helps.



来源:https://stackoverflow.com/questions/10020025/use-graph-api-explorer-to-post-a-photo

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