The Event Espresso 4 REST API is intended to allow client-side applications, and apps on different servers, to be able to interact with Event Espresso data. It is included in Event Espresso since version 4.8.29, and is built on the WP REST API included in WordPress since version 4.4.
The EE4 REST API can be used in a multitude of different ways, such as:
- Custom mobile apps
- Custom admin interfaces
- Custom registration and ticketing interfaces
- Integrating your events with other application platforms
- Provide interoperability with many different programming languages
- and much more!
By providing an agreed, standardized programmatic interface between Event Espresso and the outside world, Event Espresso opens itself up to every other application and development environment on earth.
General REST API Information for Non-Developers
In layman’s terms, an API or Application Programming Interface is an agreed set of standardized ways that a particular piece of software can be used; the rules defined for its interaction with the wider world, which govern how other pieces of software can talk to a program and how it will respond.
Here’s an example of how a REST API is designed:
In the image above, the term “tasks” is used to represent endpoints available in Event Espresso 4 such as events, tickets, registrations, venues, etc.
A few good examples of APIs in action would be:
- Anytime an app uses Google Maps to display its location information.
- A mobile or desktop twitter client.
- A game/service that integrates Facebook features such as login, messaging, etc.
In these instances, and all others like them, the APIs “expose” certain internal functions of the primary applications (Google Maps, Twitter, etc) so that outside developers can use them in their own applications or websites. In these examples, app developers have been given the ability to tap into the powerful features (and/or content) of major web services so that they can build on top of them and/or integrate key content and features into their own products, in clearly defined ways. This allows open collaboration to walk hand in hand with security.
What Is A REST API?
REST or REpresentational State Transfer is an architectural style of building APIs; not a code language or description of its function. A REST API is designed to provide a lightweight form of communication (less bandwidth) between a producer (ex: Twitter) and a consumer (ex: Twitter client), making it a reliable solution for high volume web services like Facebook, Google Apps, Twitter, WordPress, and now Event Espresso.
In this case, you are the producer of content (event information and event data), and the applications you build can consume or use that data through the Event Espresso 4 REST API.
EE4 REST API Information for Developers
Now that the REST API is in Event Espresso 4 Core, you can start developing great integration’s for your customers. All you need to get started is review the documentation and start building something GREAT!
So what’s great about the EE4 REST API and what can you do with it? Here’s a start:
- It’s built using the WordPress REST API (aka WP API). That means many plugins that work with the WP API work with it too. WP API gives the EE4 REST API a solid foundation by handling authentication, providing endpoint discovery, and supplying lots of the “behind-the-scenes” code.
- It provides read/write access to all Event Espresso 4 data: events, tickets, datetimes, registrations, custom questions and answers, payment methods, and configuration data. Even Event Espresso 4 addons’ data, like from the Mailchimp Addon or the People Addon, is available by default. If we’ve missed something tell us in the github issue tracker!
- It uses Event Espresso’s models system for querying the database. This gives API clients nearly as much querying abilities as server-side plugins. Here are some of the crazier queries we thought of:
- Names of events events happening at venues with a name containing the string “boat”:
- all approved payments for events created by the user “Eddie”:
(requires authentication to see payments though)
- all answers to the question “shirt size” for the event “Star Wars Con 2015”:
demoee.org/use-cases/wp-json/ee/v4.8/36/answers?filter[where][Question.QST_admin_name]=shirt%20size&filter[where][Registration.Event.EVT_name]=Star Wars Con 2015
(again requires authentication)
- Request as much as or as little data you want by specifying what fields and related objects to return. For example, request only event names (and don’t bother with all the extra data)
or for each registrant, include its attendee info and answers to custom questions, and the custom questions also, all in one request
(again requires authentication)
Want to learn more? Checkout our documentation and tutorials hosted on Github, including:
If you still have questions about how to build your killer app that works with the EE4 REST API, open a ticket on our github repo. We’ll try our best to answer it, and improve our documentation too.
Also you should stay tuned to our developer-specific blog at developer.eventespresso.com so you’ll know about any important changes regarding backwards compatibility or other developments.
And what if you’re wanting to create/edit EE4 data over the API? Or have some other feature request? We want to focus on what matters most to you, so let us know! Chime in on our github repo’s issue tracker to let us know it matters to you!
And if you do build something great with the EE4 REST API, consider listing it on our 3rd party addons page.
If you have an REST API feature request, or bug to report, please let us know on our github repo.
Building a WordPress Plugin? Use the EE4 Database Models Instead
If you are building a WordPress plugin that will use Event Espresso 4 data server-side (in the PHP code), generally you do not need to use the API, and can instead use Event Espresso 4’s database models, config, and other modules directly. Check out developer.eventespresso.com for tutorials on how to use many of these systems.