Chris Hampton
Chris Hampton

Reputation: 41

Creating events with the Facebook Graph API

I'm trying to create an event through the Facebook Graph API and I keep getting an "Invalid Parameter" error. I cannot figure out what the problem is.

Here is the code:

FB.api('/me/events','post',{access_token: accessToken, name: name, start_time: startTime},function(retVal) {});

This is the response:

code 100

message "(#100) Invalid parameter"

type "OAuthException"

What am I missing?

Thank you

Upvotes: 1

Views: 2922

Answers (1)

Chris Hampton
Chris Hampton

Reputation: 41

OK, so here's the deal. The access_token value has to be passed as a GET instead of a POST with the rest of the parameters. So when I changed the FB call to this:

FB.api('/me/events?access_token=' + accessToken,'post',{name: name, start_time: startTime},function(retVal) {});

It worked beautifully. I found the answer on a similar question here (Facebook Graph API ERROR), so many thanks to Bartek for solving my problem without even knowing it!

Upvotes: 1

Related Questions