Brian Duncan
Brian Duncan

Reputation: 1186

How to edit an existing event using the Facebook Graph API

I've done extensive research on this, and am baffled. Similar questions on stackoverflow have been answered with, in in short: RTFM. Well, I've done that, and more, and I still can't find how to do this.

On the main FB Graph API page, documentation is given for authenticating, reading, publishing (creating), deleting Graph objects, but I don't see modifying anywhere.

The FB Graph API > User page gives description only of how to create and delete an event on behalf of an authenticated user. I've had no problem with these two actions.

The FB Graph API > Event tells you how to retrieve an existing event, as well as publish to the existing event, posts, links, feed, etc. Once again, no help with modifying.

I've tried (desperately) (':'s removed intentionally due to hyperlink limit):

  1. Sending the same POST request as creating event, ie to https//graph.facebook.com/<user_id>/events, but with an extra 'id' parameter--the existing facebook event id. Facebook doesn't like that, gives me an 'id parameter already sent' error (I'm assuming the user's id).

  2. POSTing to the event directly ie to https//graph.facebook.com/<fb_event_id>/ using the same auth_token as was used to create it. 'Post unsupported' error message.

The fields I send along with the POST are the same as those when creating the event-- 'name', 'location' etc.


If someone's been able to do this, one simple POST example would clear everything up for me. Thanks!


UPDATE I started using the PHP SDK, but lack of examples disheartening. In hopes that this will save someone else frustration Here are doc examples augmented with an actual api call example:

"You can create an event for a user by issuing an HTTP POST request to PROFILE_ID/events with the create_event permissions and the following parameters."

$facebook->api('/'.$profile_id.'/events', 'POST', $params);

Normal enough ... but edit event docs (as of 12/7/12) are misleading:

"You can edit an event by issuing an HTTP POST to /EVENT_ID with the create_event permission. "

$facebook->api('/events/'.$eventid, 'POST', $params);

Upvotes: 0

Views: 2695

Answers (2)

John Gentilin
John Gentilin

Reputation: 86

Updating is the same as creating BUT, you can only update events created by your APP ID..

Upvotes: 0

Brad
Brad

Reputation: 556

Brian I was able to update a page event by using a POST (not a PUT) directly to the event, using the account or page authentication token. It sounds exactly like what you did in 2 above.

curl -F 'access_token=...' \
     -F 'name=A modified event name.' \
     https://graph.facebook.com/event_id

I would suggest that you try just sending a modified name field. Also, because you have already created the event, you have the correct permissions. For those who don't know, you need the extended permissions of offline_access, create_event, manage_pages, etc.

It is frustrating, because at one time there was documentation on updates on the Facebook site, but now I can't find it.

Upvotes: 2

Related Questions