Getting Started with the Eventbrite API
Let's see what Eventbrite is and how to set up credentials in order to get a private token for Eventbrite.
We'll cover the following
Eventbrite is an online ticketing and event management application. This platform can be used to search and create events.
We can create an event using Eventbrite’s online tool as an organizer. The events can be exhibitions, musical concerts, job fairs, etc. We can add the event’s description, cover art, Google map location, date and time, and much more. Eventbrite charges fees for services to the organizers if the event has paid tickets and will not charge fees if the event is free.
Eventbrite account and private token
Before diving deep into the course, let’s first create an Eventbrite account that will enable us to test the Eventbrite API’s endpoints. To create an Eventbrite account, follow these steps:
-
Go to the Eventbrite Sign-up page, enter the required email, and click “Continue.”
-
Enter the required information (confirm email, first name, last name, and password) and click “Create account.”
-
Click “Agree” after reviewing the “Terms and conditions” of Eventbrite.
-
Click “Next” after selecting your interests from different categories.
-
Enter the location or select a location from the drop-down list and click “Next.”
-
Follow the organizers that you’re interested in and click “Finish.” It will take you to the Eventbrite homepage.
-
To retrieve the private token, open this link and click “Get a Free API Key.”
-
Finally, the private token is in the text box “Your private token.”
Setting up the private token
Copy the private token you obtained by following the steps above. Now, click the “Edit” button below. Paste the private token to the PRIVATE_TOKEN
field and click the “Save” button. The PRIVATE_TOKEN
we have entered will reflect in the code widget in place of {{PRIVATE_TOKEN}}
.
We’ll use the following endpoint to retrieve account information:
https://www.eventbriteapi.com/v3/users/me/
Click the “Run” button in the code widget below to see the output.
const endpointUrl = new URL('https://www.eventbriteapi.com/v3/users/me/');const headerParameters = {'Authorization': 'Bearer {{PRIVATE_TOKEN}}','Content-Type': 'application/json'};const options = {method: 'GET',headers: headerParameters,};async function fetchUserDetails() {try {const response = await fetch(endpointUrl, options);// Custom function for printing the API responseprintResponse(response);} catch (error) {// Custom function for printing the error messageprintError(error);}}// Calling function to make API callfetchUserDetails();