Support

Home Forums Event Espresso Premium API – Fetch registrations for certain event category and certain email address

API – Fetch registrations for certain event category and certain email address

Posted: February 24, 2021 at 9:19 am

Viewing 5 reply threads


engineroomweb

February 24, 2021 at 9:19 am

Hi there,

Please could you confirm we are able to use the API to fetch registrations for certain event category and certain email address?

If so are you able to point us in the direction of the endpoint to use for this?

Thanks,
Joe


Tony

  • Support Staff

February 24, 2021 at 9:29 am

Hi Joe,

Which API are you referring to? The REST API?


engineroomweb

February 24, 2021 at 9:48 am

Hi Tony,

Yes, we need to query Event Espresso via the API to add some functionality to the site. Unless we can do this another way?

Thanks


Tony

  • Support Staff

February 24, 2021 at 1:39 pm

Yes, we need to query Event Espresso via the API

Problem is, there is more than one API, so ‘the’ API doesn’t really mean much as what you use depends on the specifics of what you need to do. For example, pulling data from another site that uses EE onto another, you want the REST API, however…

It sounds like you are on the same site that Event Espresso is installed on? If so, you would be best using the model system:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

Assuming you have the term ID and email address, for the above you can do something like:

$registrations = EEM_Registration::instance()->get_all(
	array(
		array(
			'Event.Term_Taxonomy.taxonomy' => 'espresso_event_categories',
			'Event.Term_Taxonomy.term_id' => {term_id},
			'Attendee.ATT_email' => '{email_address}'
		)
	)
);

Which will return an array of EE_Registration objects if found.


engineroomweb

February 25, 2021 at 12:48 am

Thank you so much. Just what I was looking for.

Sorry, one more question is it possible to update/remove registrations via the model system?


Tony

  • Support Staff

February 25, 2021 at 6:05 am

Yes to both.

The models take most of the work out of doing pretty much everything with EE entities, you’ll need to understand how they work and how each entity relates to another but yes, you can remove and update them.

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/using-ee4-model-objects.md

Viewing 5 reply threads

The support post ‘API – Fetch registrations for certain event category and certain email address’ 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.

Event Espresso