Lionel Chamorro
Lionel Chamorro

Reputation: 33

I cant create events with Graph Api

I'm using Graph API to create and get events from facebook. Try in various ways but always get the same results. In the case of creating an event I get an ID, but the event never see in my account. When trying to get my events always get an empty array. Try a query with fql.query but got the same result, then tested my app in the following query and got what he wanted. https://developers.facebook.com/tools/explorer

Someone can help me. Thank you very much.

This is how I'm doing

Create Event

FB.api('/me/events', 'POST', {
        name: "Evento desde mi app",
        start_time: d1,
        //end_time: d2,
        location: "En Quilmes"
    }, function (res) {
        console.log(res);

    });

Get Events

FB.api('me/events',function(data) { 
        console.log(data);
    });

FB.api({
            method: 'fql.query',
            query: 'SELECT name FROM event WHERE eid IN ( SELECT eid from event_member WHERE uid = xxxxxxx) AND creator = xxxxxxx'

        },function(response) { 
            console.log(response);
        }
    );

Upvotes: 2

Views: 926

Answers (2)

Lionel Chamorro
Lionel Chamorro

Reputation: 33

I could create an event, I still can not get my events. Try adding the access token but I get an empty array.

This is the code to create an event

        var accessToken =   FB.getAuthResponse()['accessToken'];
    var name = "My Event";
    var startTime = "07/29/2012 12:00 PM";
    var endTime = "07/29/2012 06:00 PM";
    var location = "Argentina";
    var description = "description";

    var eventData = {
        "access_token": accessToken,
        "start_time" : startTime,
        "end_time":endTime,
        "location" : location,
        "name" : name,
        "description":description,
        "privacy":"OPEN"
    };
    FB.api("/me/events",'post',eventData,function(response2){
        console.log(response2);
    });

Upvotes: 1

ShawnDaGeek
ShawnDaGeek

Reputation: 4150

Event GETs from Graph API/FQL Will Require an Access Token

All calls to get events from the Graph API or FQL will now require an access token to be used.

As announced by Facebook: https://developers.facebook.com/blog/post/2012/06/20/platform-updates--operation-developer-love/

Upvotes: 0

Related Questions