Results 1 to 3 of 3

Thread: Publishing to Facebook using low level API

  1. #1
    Join Date
    Jan 2012
    Posts
    16

    Default Publishing to Facebook using low level API

    Hi,

    we wanna post a link to Facebook ("xyz commented to item...") and therefor would like to integrate a picture within our post. We figured out you have to use GraphAPI directly in order to do so but unfortunately we can not get the necessary information regarding params from the Java docs as these are pretty limited...

    So basically setting up the map ist pretty straight forward:

    MultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();
    map.add("link", "http://www.google.com/");
    map.add("message", "Low Level API message");
    map.add("name", "Link name...");
    map.add("picture","http://www.rafting_em_brotas.jpg");

    But what do we need to pass in as params to the publish method (p1 & p2)?
    connection.getApi().publish("p1", "p2", map);

    Thanx in advance, Florian...

  2. #2
    Join Date
    Aug 2004
    Posts
    1,074

    Default

    The "p1" and "p2" parameters are the object ID and connection name. Everything in Facebook has an ID and some have an alias. For example, my ID is 738140579 and my alias is "habuma". Also, the authenticated user also has an alias of "me" as a convenience. As for the connection name, that kinda depends on what you're trying to do. Each object has a different set of connections, depending on its type. But it sounds like you want to post to the "feed" connection.

    So, if you want to post that image and message to the authenticated user's wall, you could pass in "me" and "feed". You'll need to have publish_stream permission to do this.

    The JavaDocs for GraphApi don't include the details on this...it'd be quite a lengthy bit of JavaDoc if I had to list out all of the connection names. And then I'd need to go into details on what connections are available for the various object types. Since this API is a lower-level API, it is assumed that the developer is already somewhat familiar with Facebook's Graph API, so I didn't document the details here. But I suppose it might be a good idea to include a link to Facebook's documentation at https://developers.facebook.com/docs/reference/api/ in the JavaDoc.
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Jan 2012
    Posts
    16

    Default

    Hey,

    thank you very much - works like charm!

    Cheers, FLorian!

Posting Permissions

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