Chelonian
Chelonian

Reputation: 569

Use Graph API Explorer to post a photo

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.

Upvotes: 3

Views: 4899

Answers (3)

Benedict
Benedict

Reputation: 458

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

Posting with graph explorer Hope this helps.

Upvotes: 1

Tom Waddington
Tom Waddington

Reputation: 1966

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!

Upvotes: 3

Shreeni
Shreeni

Reputation: 3317

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

Upvotes: 4

Related Questions