events_create fails in facebook

Tag: facebook Author: ejjq95 Date: 2009-07-19

strugglin to create event in javascript as

api.events_create(eventInfo,function(result,ex){

is failing and

catch(FacebookRestClientException){ gives

TypeError: api.events_create is not a function message=api.events_create is not a function

any clue

Other Answer1

Some more context would help in debugging this.

You've created the api object, yes? (e.g., var api = FB.Facebook.apiClient;)

comments:

yes thts correct

Other Answer2

I'm having the same problem. If I look at the list of functions attached to FB.Facebook.apiClient using a DOM inspector, events_create() does not exist - even though other methods like events_get() and feed_publishUserAction() are there.

Facebook might have deliberately omitted it.

Other Answer3

api.callMethod works - have put a sample call , hope it helps

        var eventInfo = {
			"name":this.name.value,
			"category":"1",
			"subcategory":"2",
			"host":"My Host",
			"location":"JP Nagar",
			"city":"Bang",
			"start_time":starttime,
			"end_time":endtime};

	function createEvent(eventinfo) {
		try{
			//check if user has extended permission to create otherwise prompt him for same
			api.users_hasAppPermission('create_event',function(res,ex){
			if (res == 0)
				FB.Connect.showPermissionDialog("create_event", 
					function(res,ex){alert("Congratulations events");});
			});

			dict = {};
			dict['event_info'] = eventinfo;
			//provide a call back or a sequencer
			var ret = api.callMethod(
					'events.create', 
					dict,
					function(eventid,ex){
						console.log(data);
					});
			return ret;
		}
		catch(FacebookRestClientException){
			console.log(FacebookRestClientException);
		}
		return;
	}//createEvent routine