This SDK interface closely mirors the Eventbrite v3 REST API endpoints that it wraps. The SDK provides many conveniences for making requests and processing responses to make it easier to use in the JavaScript environment.
First include the eventbrite
package (depending on your module environment):
Webpack / Rollup / etc (ECMAScript modules):
import eventbrite from 'eventbrite';
Node / legacy dependency systems (CommonJS / Universal Module Definition):
const eventbrite = require('eventbrite');
<script>
distribution bundle include:
<script src="https://unpkg.com/eventbrite/dist/eventbrite.min.js"></script>
NOTE: window.Eventbrite
will be a reference to the package.
In order to make requests, you need to configure the SDK object.
import eventbrite from 'eventbrite';
// Create configured Eventbrite SDK
const sdk = eventbrite({token: 'OATH_TOKEN_HERE'});
You can configure the SDK object with the following properties:
token
- The Eventbrite OAuth tokenbaseUrl
- The base URL The base URL prepended to endpoints when making API requests (defaults to'https://www.eventbriteapi.com/v3'
). When using the'/users/me/'
endpoint, a request would be made tohttps://www.eventbriteapi.com/v3/users/me/
. When using webooks, you will receive full API urls, so set thebaseUrl
to empty string (''
).
import eventbrite from 'eventbrite';
// Create configured Eventbrite SDK
// When all request endpoints will be full URLs
const sdk = eventbrite({
token: 'OATH_TOKEN_HERE',
baseUrl: '',
});
From then on, you can use sdk
to make API requests.