radu.luchian
radu.luchian

Reputation: 379

Getting list of events from page with Facebook API (Javascript SDK)

It seems I am unable to retrive the events from a Facebook page. I have done this with photo albums (from the same page) and it works excellent. After I load the API and everything I use this function to get the events and display them:

function getAlbums() {
        FB.api('/___PAGE___/events', function (resp) {
            if (resp.data !== undefined) {
                for (var i = 0, l = resp.data.length; i < l; i++) {
                    var event = resp.data[i];
                    // process events here...
                }
            }
            else 
            // no events handle             
        });
    }

It goes straight to the handle for 0 events, meaning this is true: resp.data == undefined. So I am not getting any data from the Facebook. Couldn't find any solutions to it as other mostly came accross PHP and FQL, which I cannot use here. I eed to be able to display events no matter if the user is logged in or not.

Help is greatly appreciated!

Upvotes: 1

Views: 2070

Answers (1)

Anvesh Saxena
Anvesh Saxena

Reputation: 4466

As @cpilko has mentioned, there is this bug due to which your past events are not retrieved via the Graph API. Only the future events are retrieved. You can too subscribe to the same, bug, so as to keep yourself informed if it is fixed.

Upvotes: 2

Related Questions