|
|
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 docs/reference/api/eventCode:
cucl -d quot;name=testamp;start_time=1272718027amp;location=someplacequot; PROFILE_ID/events
From the Spring Social API:Code:
void publish(java.lang.String object, java.lang.String connection, MultiValueMaplt;java.lang.String,java.lang.Stringgt; 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.
The Facebook Graph API can be boiled down to two kinds of ucls:
object ID
object ID/connection
For example, to retrieve my profile data, I'd GET 738140579 (or habuma or 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 ucl can be appended to give information about connections to that object. For example, 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 ucl pattern, except you POST data to the ucl instead of GETting data from the ucl.
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 quot;eventsquot;. The map would contain the event details such as name, start_time and location. Something like this:Code:
MultiValueMaplt;String, Stringgt; eventData = new LinkedMultiValueMaplt;String, Stringgt;();
eventData.set(quot;namequot;, quot;My Great Eventquot;);
eventData.set(quot;locationquot;, quot;Earthquot;);
eventData.set(quot;start_datequot;, quot;1272718027quot;);
facebook.publish(quot;mequot;, quot;eventsquot;, eventData);Thanks for that clarification. |
|