Update a Facebook event using the graph API

I'm trying to update an existing Facebook event, created by my application. I'm using the PHP SDK to create the event, here is the code for creating the event:

$access_token = $facebook->getAccessToken();
$page_id = $_SESSION['FAN_PAGE_ID'];

// Now, getting the PAGE Access token, using the user access token

$page_token_url = "https://graph.facebook.com/$page_id?fields=access_token&" . $access_token;
$response = file_get_contents($page_token_url);

// Parse the return value and get the Page access token
$resp_obj = json_decode($response,true);

$page_access_token = $resp_obj['access_token'];

$event_param = array(
    "access_token" =>$page_access_token,
    "name" => $postEventName,
    "start_time" => $postEventDate,
    "page_id" => $postFanPageID,
    "description" => $eventDescription,
    "location" => $location
);

try
{
   $fb_event_id = $facebook->api("/$postFanPageID/events", "POST", $event_param);
}
catch (FacebookApiException $e)
{
   echo $e->getMessage();
}

This is successfully creating an event. But I haven't found any documentation about updating an event.

I've tried using the same call but providing my existing eventID:

$facebook->api("/$postFanPageID/events/$facebookEventID", "POST", $event_param);

that just created a new event.

I've tried using this (similar to the code of deleting an event):

$facebook->api($facebookEventID, 'UPDATE', $event_param);

But this returned: Unsupported method by Facebook.

How can I update an event ? thanks.

Answers


To edit an event you have to post against the event id only – so not /$postFanPageID/events/$facebookEventID, but just /$facebookEventID instead.

See https://developers.facebook.com/docs/reference/api/user/#events, https://developers.facebook.com/docs/reference/api/page/#events


Need Your Help

TableSorter Filter and scroller widget update

jquery html tablesorter

I'm trying use TableSorter with Widgets Scroller and Filters, they work perfect,

render gives missing template error

ruby-on-rails ruby devise render

Missing template users/registrations/new with: