Results 1 to 3 of 3

Thread: Arguments for FacebookOperations publish method

Hybrid View

  1. #1
    Join Date
    Jan 2011
    Location
    Melbourne Australia
    Posts
    6

    Default 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.

    From http://developers.facebook.com/docs/reference/api/event

    Code:
    curl -d "name=test&start_time=1272718027&location=someplace" 
         https://graph.facebook.com/PROFILE_ID/events
    From the Spring Social API:

    Code:
    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.
    
        Parameters:
            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.

    Cheers.

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

    Default

    The Facebook Graph API can be boiled down to two kinds of URLs:

    https://graph.facebook.com/object ID
    https://graph.facebook.com/object ID/connection

    For example, to retrieve my profile data, I'd GET https://graph.facebook.com/738140579 (or https://graph.facebook.com/habuma or https://graph.facebook.com/me 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, https://graph.facebook.com/738140579/friends 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:

    Code:
    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);
    Craig Walls
    Spring Social Project Lead

  3. #3
    Join Date
    Jan 2011
    Location
    Melbourne Australia
    Posts
    6

    Default

    Thanks for that clarification.

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
  •