Support

Home Forums Event Espresso Premium Accessing tickets associated with a given event over the REST API

Accessing tickets associated with a given event over the REST API

Posted: June 22, 2016 at 11:32 am


Diane Kuhler

June 22, 2016 at 11:32 am

I need to be able to list the tickets available for a given event via the REST API. In theory, I see that each event links to a list of datetimes and each datetime links to a list of tickets, but that’s a lot of requests just to list the tickets available for an event. Any better way to do this? If not, can we get this added? It seems like a /events/[eventid]/tickets endpoint wouldn’t be too hard to add.


Josh

  • Support Staff

June 22, 2016 at 2:59 pm

You can build a query that chains together the related fields. eg.

http://{yoursite.com}/wp-json/ee/v4.8.36/tickets?include=TKT_name&where[Datetime.Event.EVT_ID]={eventID}

There are a few other examples in the EE4 Rest API documentation:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/C–REST-API/ee4-rest-api-GET-filtering-results.md#related-resources-fields-are-also-queryable


Diane Kuhler

July 4, 2016 at 8:39 pm

I am struggling to figuring out valid filters. How would you filter for the registrations and attendies for a particular event? How do I figure out the correct field to put in the where[] parameter?

Thanks


Josh

  • Support Staff

July 5, 2016 at 1:26 pm

The API is based on EE’s core model querying system. So the fields match what’s in the class constructor. There’s actually a list of fields for the Registration table in another article in the developer documentation:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-querying.md#model-fields

One way to get registrations for a specific event is:

http://{yoursite.com}/wp-json/ee/v4.8.36/registrations/?where[EVT_ID]=567

The support post ‘Accessing tickets associated with a given event over the REST API’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 3 years, 4 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[for="input_96_5_3"]
[for="input_96_5_3"]
[gravityform id=96 title=false description=false]
  • This field is for validation purposes and should be left unchanged.
[i]
[i]
[gravityform id=69 title=false description=false]
  • This field is for validation purposes and should be left unchanged.