REST API additions and changes in 4.8.36

In Event Espresso 4.8.36 we’re releasing a new EE namespace for the EE4 REST API, with a few new changes:

  • totals in headers, so that you can easily get a count of items in a set. Eg if you want to count how many events are upcoming, before you would need to query for all events and count them yourself. Now the header “X-WP-Total” is included in the response and contains the count of all items in the collection, ignoring any limit set on the query. See the related documentation on response headers
  • calculated fields, optional extra fields which can be included in responses which contain information that’s otherwise available but tricky to figure out. Eg, in order to calculate the total registrations made for an event, instead of needing to manually query for all the registrations and count them yourself, you can instead add calculate=spots_taken onto a GET request for events, and the count of approved registrations for the event will be included as part of each event returned in the collection. See the related documentation on calculated fields
  • new representation for infinity: before whenever a response item needed to represent infinity (eg a ticket with no limit)  we represented it with -1. Going forward we will be using null to represent infinity seeing how it’s less ambiguous than -1 (because there are times a field could be negative or infinity). This is only a change in the new 4.8.36 endpoints and any future releases of the EE4 REST API; endpoints in the namespaces 4.8.34, 3.8.33 and 4.8.29 will continue to use -1 for infinity for backwards compatibility. See the note on gotchas, which include this change.

As  usual, let us know what you think!

Leave a Reply

Your email address will not be published. Required fields are marked *