-2

Here is a function which is call when user click a button to attend a event on facebook, these following code get the login information from user and add there particular event to the user fb event to attending the event.

These code is giving me the syntax error, i does not Know what is the error. Please help its needy.

function gogingtoevent() {
        FB.login(function(response) {
            if (response.status == 'connected') {
                FB.api('/816891388384961/attending', 
                 function (response) {
                   if (response && !response.error) {
                        alert('Attending');
                       }else{
                            alert (JSON.stringify(response));   
                       }
                    });
            }else{
                alert('Not Responding');
            }
        });
    }
Wasim Khan
  • 37
  • 2
  • What is the actual error message and line number of the error? This code looks syntactically correct (but could be formatted better). – concrete_d Apr 13 '15 at 05:55
  • {"error":{"message":"Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api","type":"GraphMethodException","code":100}} – Wasim Khan Apr 13 '15 at 06:07
  • this is a error which is generated and i read the error code its because of syntax in give the error – Wasim Khan Apr 13 '15 at 06:08
  • This looks like an issue with the URL you are providing. Are you sure you have permissions set correctly? This may help: http://stackoverflow.com/questions/20957095/unusual-behavior-of-facebook-grap-api-type-graphmethodexception-code-1 – concrete_d Apr 13 '15 at 06:12
  • i set privacy of event is open invite – Wasim Khan Apr 13 '15 at 06:55
  • RSVP-ing as attending requires a _POST_ request … you are making a GET request only. – CBroe Apr 13 '15 at 06:55
  • when i add post it give the error – Wasim Khan Apr 13 '15 at 07:02
  • (#299) Requires extended permission: rsvp_event – Wasim Khan Apr 13 '15 at 07:02

1 Answers1

0

You need to do a POST request to this edge, and you need the rsvp_event permission.

It's all in the docs:

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • how to set rsvp_event permission – Wasim Khan Apr 13 '15 at 07:20
  • You need to request it during the app login flow. https://developers.facebook.com/docs/facebook-login/permissions/v2.3#adding – Tobi Apr 13 '15 at 07:23
  • i add the type post and rsvp_event permission scope: 'read_stream,publish_stream,offline_access,rsvp_event' – Wasim Khan Apr 13 '15 at 07:53
  • `read_stream,publish_stream,offline_access` are all deprecated. HOw does your code look like now? Without the code nobody will be able to help you. See https://developers.facebook.com/docs/javascript/reference/FB.api/ – Tobi Apr 13 '15 at 08:00
  • FB.login(function(response) { if (response.authResponse) { FB.api("/816891388384961/attending", "POST", function (response) { if (response && !response.error) { alert('Attending'); }else{ alert (JSON.stringify(response)); } }); } },{ scope: 'rsvp_event' }); – Wasim Khan Apr 13 '15 at 08:02
  • {"error":{"message":"(#299) Requires extended permission: rsvp_event","type":"OAuthException","code":299}} – Wasim Khan Apr 13 '15 at 08:31
  • Then, the permission has either not been granted, or not been requested. Remove the app from the user profile's app settings, and try to login again. – Tobi Apr 13 '15 at 08:54