Home > Uncategorized > Access #EventBrite API to display event information

Access #EventBrite API to display event information

eventbrite-750

If you’re creating a What’s On guide, or need to supplement one with existing events, then the EventBrite API is free, and is easy to use. Here is an example below using NodeJS and the Request NPM package.

First, off, you need to authenticate with a Bearer Token, this is easy to do, but you’ll need to get one from the Developer portal on Eventbrite. Here’s some NODE code that makes an authenticated request against the Eventbrite API

function EventbriteRequest(strUrl, callback)
{

request(
{
uri: strUrl,
headers:
{
‘Content-Type’: ‘application/json’
},
auth: {
bearer: ‘xxxxxxxx’
}
}, function (error, response, body) {
console.log(‘error:’, error);
console.log(body);
if (error == null)
{
var jBody = JSON.parse(body);
callback(jBody,null);
}
else
{
callback(null,error);
}
});
}

This simply takes an eventbrite URL, and a callback, which will contain the response in the first parameter, or null, and an error in the second parameter.

And to make a “Whats On” type search, you simply call the following

var strUrl = “https://www.eventbriteapi.com/v3/events/search?”;
strUrl += “q=” + search;
strUrl += “&location.address=northern+ireland”;
console.log(strUrl);
EventbriteRequest(strUrl, function(response, error)
{

….

This is taken from an Alexa app, but retired as a feature for other reasons.

Advertisement
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: