Last week was a great week for the Event Espresso REST API – we have just released new API WRITE endpoints with create, update and delete functionality. The new WRITE endpoints make it easier to create new features and integrate with third-party services and applications.
Easier to Create New Features
With WRITE endpoints in the Event Espresso 4 REST API, developers will find it much easier to create innovative new features for Event Espresso. In fact, we are already starting development of recurring events, and are close to releasing a beta version of the Waiting List Manager. Both of these add-ons wouldn’t be possible without the REST API.
Opening Doors to Innovation and Integration with Third-Party Services
The WRITE endpoints of the API open the door to integration’s with many third-party services. For example, developers can create software running anywhere, in any language, to create events, registrations, and transactions via the REST API, instead of being limited to only doing so from the WordPress admin or a custom plugin. With READ endpoints you can sync data from Event Espresso to other applications, but now with WRITE endpoints you can sync data from other applications TO Event Espresso.
The REST API is For Developers
Now that the Event Espresso REST API in Event Espresso 4 Core now supports READ/WRITE API endpoints, 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!
The EE4 REST API can be used in a multitude of different ways, such as:
- Custom mobile apps
- Custom admin interfaces
- Integrating your events with other application platforms (e.g. Hubspot, and other CRMs, etc.)
- 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.
Code Samples for Developers
So what’s great about the EE4 REST API and what can you do with it? Here’s a start:
Requests sent are normal HTTP requests with:
- a method (POST/PUT/DELETE) which specifies whether to insert, update or delete data
- a URL (e.g. `https://mysite.com/wp-json/ee/v4.8.36/events`) specifying what Event Espresso data you want to interact with
- and a request body (eg `EVT_name=my-event&EVT_desc=my-events-description`) specifying how to change the data.
A good way to become familiar with the EE4 REST API is to use Postman, or some other program that creates HTTP requests. In Postman, you can easily specify which HTTP method to use, what URL to send the request to, and what to put in the request’s body.
Example of data creation over the REST API
Here is an example request using Postman which sends a POST request to `http://src.wordpress-develop.dev/wp-json/ee/v4.8.36/answers`, providing:
- `QST_ID` (the ID of the question this is an answer to)
- `REG_ID` (the ID of the registration who gave this answer)
- and an `ANS_value` (their actual answer).
Under “body” you see the request body (what the REST API responded with), which was just the newly-created answer’s data.
If you were writing a WordPress plugin that uses the same REST API, you could send this same request using this code snippet:
For more info about the WP HTTP API, see its documentation.
You could equally use the popular Guzzle library or a library from another programming language.
For more documentation about how to make requests to create other data, or how to update data and delete it, please read our documentation about Writing Data over the EE4 REST API.
Support & Feedback
If you have an REST API feature request, or bug to report, please let us know on our Github repo.
Also be sure to 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.
What Cool Things are You Doing with the REST API?
The availability of the EE4 REST API as a core feature also means less time spent by developers creating something similar, and more time spent creating features and custom applications. Let us know what cool ideas you’ve come up with in the comments below.
If you do build something great with the EE4 REST API, consider listing it on our 3rd party addons page.