Announcement Announcement Module
No announcement yet.
Arguments for FacebookOperations publish method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Arguments for FacebookOperations publish method

    I wish to publish an event to Facebook. Looking at the publish method of the FacebookOperations class it's not apparent what the arguments are for. I greped through the Greenhouse codebase and I couldn't find an example.


    curl -d "name=test&start_time=1272718027&location=someplace" 
    From the Spring Social API:

    void publish(java.lang.String object, java.lang.String connection, MultiValueMap<java.lang.String,java.lang.String> data)
    Low-level publish-to-Facebook method for publishing any type of object supported by Facebook's API.
            object - The ID of the object to publish to.
            connection - The connection to be published.
            data - The data to be published.
    My assumption is that the object argument is the PROFILE_ID in the FB API, and the that data map is the key/value pairs of the events details.

    I'm however not sure what the connection parameter is for.

    Clarification (or pointing out where I'm wrong ) is appreciated.


  • #2
    The Facebook Graph API can be boiled down to two kinds of URLs: ID ID/connection

    For example, to retrieve my profile data, I'd GET (or or if I'm authenticated). 738140579 is the object ID for my profile, but it could be the object ID for some other type of Facebook object, including events.

    That same URL can be appended to give information about connections to that object. For example, would get you a list of my friends...assuming you have authorization to see my friend list.

    Publishing to Facebook follows that same URL pattern, except you POST data to the URL instead of GETting data from the URL.

    For your case, you want to publish an event. So, the object ID would be your profile ID (as the event owner) and the connection would be "events". The map would contain the event details such as name, start_time and location. Something like this:

    MultiValueMap<String, String> eventData = new LinkedMultiValueMap<String, String>();
    eventData.set("name", "My Great Event");
    eventData.set("location", "Earth");
    eventData.set("start_date", "1272718027");
    facebook.publish("me", "events", eventData);


    • #3
      Thanks for that clarification.