A javascript library for accessing functionality within the Eventjoy API.
Today, the API is in private beta and you’ll need to request access to get started. We’re doing this so we can work closely with our initial developers to ensure stability, performance, and better understand how our API is being used.
By using our API and Webhooks, you agree to our API Terms of Service.
During this time, it’s critical that we receive as much feedback as possible. If you’re working with our API, please send all feedback to [email protected]
- Setup
- OAuth Functions
- API Functions
eventjoy.events_search(params, complete)eventjoy.events(event_id, complete)eventjoy.events_tickets(event_id, params, complete)eventjoy.events_orders(event_id, params, complete)eventjoy.events_attendees(event_id, params, complete)eventjoy.order(order_id, complete)eventjoy.order_attendees(order_id, params, complete)eventjoy.organizer(organizer_id, complete)eventjoy.organizer_events(organizer_id, params, complete)
- Sorting, Paging & Includes
- Errors & Exceptions
To setup, simply include eventjoy.js within the <head> section of your page:
<script type="text/javascript" src="eventjoy.js"></script>Once included, an eventjoy object will be available within the global namespace. This object is used for accessing all library functionality.
Next, you must set your developer API key (see the API Docs for details on obtaining an API key)
eventjoy.setApiKey('<INSERT YOUR API KEY HERE>');While authentication is optional, it is necessary for accessing protected data, such as a user's private events and order/attendee information.
To begin authenticating, you want to prompt the user to allow your app to access their data using eventjoy.login. This will automatically open a new window where they can log into Eventjoy (if not currently logged in) and authorize your application.
eventjoy.login(function(success) {
// The completion function is called when the oauth window is closed
});Upon successful authorization, the user will be redirected to the 'Redirect URL' you specify when creating your Eventjoy application (see the API Docs for more details). From your redirect URL you should obtain the request_token and convert this to an access_token (details here: https://api.eventjoy.com/docs#request-token).
Note: The
completefunction will be called anytime the login/authorization window closes, regardless of whether authorization succeeds. This is your opportunity to fetch theaccess_tokenyou stored when you processed the authorization from your Redirect URL, or report a login error if noaccess_tokenwas found, if appropriate.
Once you have a valid access_token you can apply this to eventjoy.js using the following call:
eventjoy.setAccessToken( <string containing acquired access token> );You will now be able to access all OAuth-only functions.
All API function calls take a complete callback as the last parameter. This callback always takes the following format:
function complete(success, jsonResponse) {
...
}GET /events/search
Search for public events using one or more parameters.
| Name | Type | Description |
|---|---|---|
| params | object |
A JSON object containing sorting/paging parameters, as well as the search parameters (see below) |
| complete | function |
A block function to receive the JSON response |
In addition to the sorting/paging parameters, the event search also supports the following additional parameters:
| Name | Type | Description |
|---|---|---|
| name | string |
(optional) Partial name of event you are searching |
| description | string |
(optional) Partial description of event you are searching |
| venue | string |
(optional) Partial venue name of event you are searching |
| category | string |
(optional) Partial category name of event you are searching |
| industry | string |
(optional) Partial industry info of event you are searching |
| location[lat] | float |
(optional) Latitude of event you are searching |
| location[long] | float |
(optional) Longtitude of event you are searching |
| location[distance] | float |
(optional) Distance of event from lat/long you have specified [default: 50] |
| location[unit] | string |
(optional) Distance unit. (available units are km, mi, m, and ft) [default: mi] |
eventjoy.events_search({'name': 'party', 'sort': '-created'}, function(success, events) {
...
});The response returned to the complete function upon success will match the response example given for the /events/search API endpoint here: https://api.eventjoy.com/docs#search-events
Fetch a particular event by its event_id value. You may also use null in place of an event_id to fetch all events owned by the authenticated user.
| Name | Type | Description |
|---|---|---|
| event_id | integer |
The numeric event_id of the event (or null) |
| params | object |
A JSON object containing sorting/paging parameters |
| complete | function |
A block function to receive the JSON response |
Note: the use of
nullin place of anevent_idmakes this function OAuth-Only.
// Fetch a single public event with a known event_id (no OAuth required)
eventjoy.events(12345, {'include': 'tickets'}, function(success, events) {
...
});
// Fetch recent events owned by the authenticated user (requires OAuth)
eventjoy.events(null, {'include': 'tickets', 'sort': '-created'}, function(success, events) {
...
});The response returned to the complete function upon success will match the response example given for the /events/{event_id} API endpoint here: https://api.eventjoy.com/docs#get-a-particular-event
GET /events/{event_id}/tickets
Fetch all ticket types for the specified event.
| Name | Type | Description |
|---|---|---|
| event_id | integer |
The numeric event_id of the event |
| params | object |
A JSON object containing sorting/paging parameters |
| complete | function |
A block function to receive the JSON response |
eventjoy.events_tickets(12345, {'sort': '+name'}, function(success, tickets) {
...
});The response returned to the complete function upon success will match the response example given for the /events/{event_id}/tickets API endpoint here: https://api.eventjoy.com/docs#get-all-event-tickets-types
Note: This is an OAuth-only function
Fetch all completed orders for the specified event.
| Name | Type | Description |
|---|---|---|
| event_id | integer |
The numeric event_id of the event |
| params | object |
A JSON object containing sorting/paging parameters |
| complete | function |
A block function to receive the JSON response |
eventjoy.events_orders(12345, {'sort': '-created'}, function(success, orders) {
...
});The response returned to the complete function upon success will match the response example given for the /events/{event_id}/orders API endpoint here: https://api.eventjoy.com/docs#get-all-event-orders
GET /events/{event_id}/attendees
Note: This is an OAuth-only function
Retrieves all attendees attenfind a particular event.
| Name | Type | Description |
|---|---|---|
| event_id | integer |
The numeric event_id of the event |
| params | object |
A JSON object containing sorting/paging parameters |
| complete | function |
A block function to receive the JSON response |
eventjoy.events_attendees(12345, {'sort': '-created'}, function(success, attendees) {
...
});The response returned to the complete function upon success will match the response example given for the /events/{event_id}/attendees API endpoint here: https://api.eventjoy.com/docs#get-all-event-attendees
Note: This is an OAuth-only function
This endpoint retrieves a specific order through its order_id.
| Name | Type | Description |
|---|---|---|
| order_id | integer |
The numeric order_id of the order to fetch |
| complete | function |
A block function to receive the JSON response |
eventjoy.order(12345, function(success, order) {
...
});The response returned to the complete function upon success will match the response example given for the /orders/{order_id} API endpoint here: https://api.eventjoy.com/docs#get-an-order
GET /orders/{order_id}/attendees
Note: This is an OAuth-only function
Retrieves all attendees registered through an order_id.
| Name | Type | Description |
|---|---|---|
| order_id | integer |
The numeric order_id of the attendees to fetch |
| params | object |
A JSON object containing sorting/paging parameters |
| complete | function |
A block function to receive the JSON response |
eventjoy.order_attendees(12345, {'sort': '-created'}, function(success, order) {
...
});The response returned to the complete function upon success will match the response example given for the /orders/{order_id}/attendees API endpoint here: https://api.eventjoy.com/docs#get-attendees-by-order
GET /organizers/{organizer_id}
Fetch a particular organizer profile by its organizer_id value. You may also use null in place of an organizer_id to fetch all events owned by the authenticated user.
| Name | Type | Description |
|---|---|---|
| organizer_id | integer |
The numeric organizer_id of the organizer (or null) |
| complete | function |
A block function to receive the JSON response |
Note: use of
nullmakes this function OAuth-Only.
eventjoy.organizer(12345, function(success, organizer) {
...
});The response returned to the complete function upon success will match the response example given for the /organizers/{organizer_id} API endpoint here: https://api.eventjoy.com/docs#get-an-organizer-profile
GET /organizers/{organizer_id}/events
Fetch all events owned by the specified organizer. You may also use null in place of an organizer_id to fetch all events owned by the authenticated user.
| Name | Type | Description |
|---|---|---|
| organizer_id | integer |
The numeric organizer_id of the organizer (or null) |
| params | object |
A JSON object containing sorting/paging parameters |
| complete | function |
A block function to receive the JSON response |
Note: use of
nullin place of anorganizer_idmakes this function OAuth-Only.
eventjoy.organizer_events(12345, {'sort': '-created'}, function(success, tickets) {
...
});The response returned to the complete function upon success will match the response example given for the /organizers/{organizer_id}/events API endpoint here: https://api.eventjoy.com/docs#get-an-organizer's-events
For functions that fetch multiple events/orders/attendees, a params object is passed as a parameter. This can be used to control the quantity and order of the objects returned.
The following parameters can be used:
| Name | Type | Description |
|---|---|---|
| page[number] | integer |
(optional) Page number. Max page number is calculated based on the number of events and page[size]. |
| page[size] | integer |
(optional) By default, 50 events will be displayed per page. You can change the size to display more or less events per page. |
| sort | string |
(optional) The name of the event property to sort by. A prefix of + means ascending, - means descending. All events are sorted by created in ascending order at the moment. [Default: +created] |
| include | string |
(optional) This allows additional objects to be fetched and attached to the returned data. Possible values are tickets, attendees and organizer. |
// Fetch my recently created events, 10 per page, including the ticket information for the events...
eventjoy.events(null, {
'page[number]': 5,
'page[size]': 10,
'sort': '-created',
'include': 'tickets'
}, function(success, events) {
...
});All failures when communicating with the API will result in an exception being thrown, so it is advisable to use try/catch blocks to handle these exceptions. The following are errors that may be thrown:
- 400 Bad Request – Your request was bad
- 401 Unauthorized – Your API key is wrong
- 403 Forbidden – The data requested is only accessible by its event organizers
- 404 Not Found – The specified object could not be found
- 405 Method Not Allowed – You tried to access data with an invalid method
- 406 Not Acceptable – You requested a format that isn’t JSON
- 410 Gone – The object requested has been removed from our server
- 429 Too Many Requests – Whoa there! You’re requesting too much! Slow down!
- 500 Internal Server Error – We had a problem with our server. Try again later
- 503 Service Unavailable - We’re temporarially offline for maintanance