Announcement Announcement Module
No announcement yet.
Publishing to Facebook using low level API Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Publishing to Facebook using low level API


    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", "");
    map.add("message", "Low Level API message");
    map.add("name", "Link name...");

    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
    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'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 in the JavaDoc.


    • #3

      thank you very much - works like charm!

      Cheers, FLorian!