See Eventbrite's developer site for updated info on how to use thier new APIs: https://developer.eventbrite.com
written by @ryanj, with ISO 8601 date support provided by Colin Snover
The following parameters can be used to initialize the Eventbrite API client:
app_key
: (REQUIRED) Eventbrite users can request an API key on the following page: http://www.eventbrite.com/api/key/user_key
: (OPTIONAL) Omitting this parameter will limit access to public data. Providing a user_key is only needed when updating/accessing private information. Each user can find theiruser_key
on this page: http://www.eventbrite.com/userkeyapiaccess_token
: (OPTIONAL) If you are using OAuth2 with Eventbrite, you can also initialize our API client by supplying a user's access_token (instead of supplying an api_key and user_key). For more information on how to get started with OAuth2, see our OAUTH2-README.callback
: for interacting with the API
Eventbrite({'app_key': "YOUR_API_KEY", 'user_key':"YOUR_USER_KEY"}, function(eb_client){ //eb_client interaction goes here... });
OR, if when using an OAuth2 access_token:
Eventbrite({'access_token': "USER_ACCESS_TOKEN"}, function(eb_client){ //eb_client interaction goes here... });
Within the callback, the client can be used to call any of the methods described in the Eventbrite API Docs:
// parameters to pass to the API
var params = {'city': "San Francisco", 'region':'CA'};
// make a client request, provide another callback to handle the response data
eb_client.event_search( params, function( response ){
console.log( response );
});
eb_client.event_get( {'id': 123456789 }, function( response ){
// render the event as a ticket widget:
var ticket_widget_html = eb_client.widget.ticket( response.event );
// or, render it as a countdown widget:
var countdown_widget_html = eb_client.widget.countdown( response.event );
console.log( countdown_widget_html + ticket_widget_html );
});
eb_client.event_list_attendees ( {'id': 123456789 }, function( response ){
console.log(response);
});
eb_client.user_list_events ( {}, function( response ){
$( '#target' ).html( eb_client.utils.eventList( response, eb_client.utils.eventListRow ));
});
WARNING: user_keys provide privileged access to a user's private data. Keep it secret. Keep it safe.
Eventbrite does not recommend storing authentication tokens in client side source.
See the included example.html file for a more detailed implementation example.