How to upload a picture for an event using the Facebook Graph API?

后端 未结 5 1940
慢半拍i
慢半拍i 2021-02-03 11:33

I would like to know how to add a picture to an event using the Facebook Graph API. I have seen this question and tried some variations on that theme, without any success. The o

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-03 12:19

    Here is a sample example using FbGraph written by Nov Matake in Ruby on Rails. I spend lots of hours to figure out, How to upload an image for an event. I hope this will help and save others time.

    me = FbGraph::User.me(ACCESS_TOKEN)
    event = me.event!(
      :name => 'FbGraph test event',
      :start_time => 1.week.from_now.to_i,
      :end_time => 2.week.from_now.to_i,
      :picture => File.new("/home/jeetu/Desktop/my_birthday.png")
    )
    

提交回复
热议问题