Question:

I am trying to set the RSVP flag for a user's Event by using JavaScript SDK, however, the following function does not work. It does not set the RSVP flag but just only returns individuals who are attending.

attendThisEvent = function() {
  FB.api('/{EVENT_ID}/attending', function(response) {
    if(response.error) {
       alert(response.error['message']);
    } else {
       alert(response.description);
    }
  } , {access_token: my_access_token} );
}

What am I doing wrong?

 

 

Answer:

Appreciate if you can like this page if you find it useful! - Click "Like"

In the above coding,

  FB.api('/{EVENT_ID}/attending', function(response) { ... }

is just a GET request...

To set the RSVP flag, you have to use a POST request,

FB.api('/{EVENT_ID}/attending', 'post', function(response) { ..... }

 

 

Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!