Results 1 to 5 of 5

Thread: Spring Social - Facebook - Post a photo to friend's wall

  1. #1
    Join Date
    Mar 2012
    Posts
    3

    Default Spring Social - Facebook - Post a photo to friend's wall

    Hello,

    I am looking for instructions to post a photo to friend's wall using Spring Social Facebook version 1.0.1
    Please kindly instruct me on how to do this, or look to issue here to advise me if I missed something. Many thanks in advance.

    I was looking to MediaOperations API for methods to post photo, and there're 4, but none came with a "String ownerId" parameter, which I assumed to stand for the friend ID.

    Alternatively, it looks like I can post the photo to the friend's wall via an album (via MediaOperations API, by call postPhoto(String albumId, Resource photo, String caption)). Do I understand that correctly?
    When I came to create the album, such an implementation is available in MediaTemplate class (createAlbum(String ownerId, String name, String description)) but the corresponding API was not existed in MediaOperations interface.
    Can you please let me know if the implementation is not available to use yet?

    Thank you and have a great day.

    -Chau

  2. #2
    Join Date
    Mar 2012
    Posts
    3

    Default

    Hello, I think I figured it out to use the low level API GraphApi.publish().

  3. #3
    Join Date
    Aug 2004
    Posts
    1,075

    Default

    Glad you figured it out. And thanks for pointing out that there's no support for posting photos to a friend's wall. I'll definitely have to look into adding that.

    Could you share the code you used with GraphApi.publish() for the rest of the community to learn from until I get it added to the API binding?

    I actually already have some work in progress to support a cleaner way of posting to a wall (no matter who owns it, as long as you have permission to do so) and this work should make it easier to add a photo as well. It's just rough work right now (in a local branch), though.
    Craig Walls
    Spring Social Project Lead

  4. #4
    Join Date
    Mar 2012
    Posts
    3

    Default

    Hello, Craig,

    Here is the method I 'd like to share with others as a mean "to do the fishing":
    View source of your implementation Facebook.mediaOperations().postPhoto(), and found the invocation of
    graphApi.publish("me", "photos", parts)
    so, what next to do is replace "me" alias with a Facebook friend ID.

    Beside "photos", developer can look into Facebook Graph API (http://developers.facebook.com/docs/reference/api/) to look for other connection type and work on those objects as well. These are just 0.02$ note from a fan understand that changes from Facebook (and Spring) come rapidly.
    I had a chance to look into the code in Github and think we developers are exciting to consume more new functions then. Keep up the great work.

    Finally, here is the "fish" (a shameless copy & paste of your code)
    Resource photo =
    String caption =
    MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
    parts.set("source", photo);
    parts.set("message", caption);
    return graphApi.publish(facebookFriendid, "photos", parts);

    Have a great day.

    -Chau

  5. #5
    Join Date
    Mar 2012
    Posts
    10

    Default

    I think you should use GraphApi.publish().

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •