Use Graph API Explorer to post a photo

My ultimate goal is to do this programmatically, but as a common sense test, I'm trying to just post an uploaded photo (from my computer) to a Facebook page using the Facebook API. I have 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 this?
Thank.

+3


source to share


3 answers


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

Facebook accepts a url parameter to load images - point to the full image url and Facebook should pick it up. Since it is just a string, you can use explorer to do this.



However, Facebook should come back with reasonable errors for uploading photos - I'd start coding instead of worrying about the explorer tool!

+3


source


Use curl with the -F and "source =" flags and it should work. Here is a code snippet from one of our applications (we are building 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

      

+4


source


I was able to post images from the browser's Graph API using this !

Graphical Explorer Wiring Hope this helps.

+1


source







All Articles