I am trying to create Facebook events using its API as shown in the following code snippet.
function myCallback(callback_response) {
var eventid = "";
FB.api('me/events?access_token=(access_token)', 'POST', {name: "Test Event", start_time:1343143952067, privacy:"OPEN", location: "London, England"}, function(response){
eventid = response.id;
// eventid gets successfully return,
// however, accessing this eventid publicly returns 'false'
FB.api('/'+ eventid+ '/invited?access_token=(access_token)&users='+callback_response.to,'POST',function(response) {
// users successfully invited
});
});
}
The problem I am facing is that even though the event gets created and I get an eventid as a response, my second FB.api call to add users to the event fails. Also, on accessing the event directly (https://graph.facebook.com/(eventid)), facebook API returns false.
I have granted the create_event permission to the user so that should not be the problem. I am not sure why I am not able to see events created by own userid. Any suggestions?
I solved the problem. In this particular case, it has nothing to do with access_token. The problem is with the format of start_time field.
Replacing (start_time:1343143952067) with something like (start_time:”2012-10-29T12:00:00″) solves the problem.