Access #EventBrite API to display event information
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.