通过 Spring Social 使用图像创建 Facebook 事件
查看 spring 社交 facebook api,EventOperations 提供
createEvent(java.lang.String name, java.lang.String startTime,
java.lang.String endTime)
将事件发布到 facebook 的功能。
有没有办法发布活动的更多信息,例如活动图片和活动描述?
Looking over the spring social facebook api, EventOperations offers
createEvent(java.lang.String name, java.lang.String startTime,
java.lang.String endTime)
to post Events to facebook.
Is there a way to post more information for the event, like event image and event description?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看
createEvent
方法,它当前不支持附件(事件图像)。然而,它确实调用 GraphApipublish
来实际发布事件:graphApi
.publish(...) 本身(在 Facebook 模板 )将支持任何东西作为 Facebook 准备接受的 {key,value} 对,因为它只是委托给 RestTemplate,并通过常规 HTTP POST 将所有 {key,value} 对提供给 Facebook :因此您可以扩展 EventTemplate 并添加另一个
createEvent
方法,该方法将采用图像名称
和图像文件路径
,并将其作为附加的 {key,value} 添加到data
MultiMap 中:因此该方法看起来接近于:
这当然不包括您可能想要执行的任何可能的验证等。 。
一旦你完成了这项工作(这似乎非常简单),你可以将其捐赠/贡献回 Spring Social =>他们会很高兴:)
Looking at
createEvent
method, it does not currently support the attachment (event image). It does however call into GraphApipublish
to actually publish the event:graphApi
.publish(...) itself ( which is implemented in FacebookTemplate ) would support anything as a {key,value} pair that Facebook is ready to accept, as it just delegates to the RestTemplate, and feeds all the {key,value} pairs to Facebook through a regular HTTP POST:Hence you can extend the EventTemplate and add another
createEvent
method, that would take animage name
and animage file path
, and would added it as an additional {key,value} to adata
MultiMap:Hence the method would look close to:
This of course does not include any possible validation that you might want to do, etc..
Once you have this working, which seems to be pretty straightforward, you can donate / contribute it back to Spring Social => they'd be very pleased :)
尽管当时提供的答案可能是正确的,但现在这个答案具有误导性和错误性。从 v2.1 开始,您无法通过 API 创建/更新/删除事件。
https://developers.facebook.com/docs/graph- api/reference/v2.1/event/
Although answer provided was possibly correct at the time, nowadays this answer is misleading and wrong. Since v2.1 onwards you can't do CREATE/UPDATE/DELETE of Events via API.
https://developers.facebook.com/docs/graph-api/reference/v2.1/event/